Thread: how do I stop text from being erased

  1. #1
    Registered User
    Join Date
    Jan 2006
    Posts
    49

    how do I stop text from being erased

    I have a function that uses DrawText(.....) to output a text display in my window. However, when I resize/minimize/move the window (in other words when WM_PAINT is called) the text is erased. How do I stop this? I tried using ValidateRect to stop that area from being erased but that doesn't work. Is there anyway to do it without having to call my function from within the WM_PAINT message? Thanks.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,981
    Try handling WM_ERASEBKGND - and have it do nothing.

    gg

  3. #3
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    Depends on when and to what Device Context you are drawing the text.

    Simplest and slowest solution....

    Draw the text in the WM_PAINT

    Best and fastest solution.

    Look into 'double buffering' ie create a memory DC and draw your text into it. In the WM_PAINT BitBlt() this memory DC to the paint DC using the paint area (rect) (both are in the PAINTSTRUCT returned by BeginPaint()).
    "Man alone suffers so excruciatingly in the world that he was compelled to invent laughter."
    Friedrich Nietzsche

    "I spent a lot of my money on booze, birds and fast cars......the rest I squandered."
    George Best

    "If you are going through hell....keep going."
    Winston Churchill

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Text adventure engine idea. thoughts?
    By suzakugaiden in forum Game Programming
    Replies: 16
    Last Post: 01-15-2006, 05:13 AM
  2. Appending text to an edit control
    By dit6a9 in forum Windows Programming
    Replies: 3
    Last Post: 08-13-2004, 09:52 PM
  3. Text positioning and Text scrolling
    By RealityFusion in forum C++ Programming
    Replies: 3
    Last Post: 08-13-2004, 12:35 AM
  4. Scrolling The Text
    By GaPe in forum C Programming
    Replies: 3
    Last Post: 07-14-2002, 04:33 PM
  5. Replies: 1
    Last Post: 07-13-2002, 05:45 PM