Thread: RePaint Problem

  1. #1
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483

    RePaint Problem

    I have a program that is somewhat like ms Paint.

    And everytime its repainted w/e was drawn on it gets deleted.
    I know why, thats not the case. I want to know how to keep whatever was drawn there, without it beind deleted everytime its resized or repained.

    Any suggestions how i could do that?

    Thanks

    EDIT:

    By the way im using Win32.
    My Website
    010000110010101100101011
    Add Color To Your Code!

  2. #2
    Registered User
    Join Date
    Nov 2001
    Posts
    1,348
    Check out WM_ERASEBKGND.

    Kuphryn

  3. #3
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    I dont get it.

    what do i do when i get the message?

    Im guessing that i would have to create a bush out of whats drawn on the screen and repaint with the brush? or what?
    My Website
    010000110010101100101011
    Add Color To Your Code!

  4. #4
    C++ Enthusiast jmd15's Avatar
    Join Date
    Mar 2005
    Location
    MI
    Posts
    532
    Just a guess, but maybe when you receive that message make it do nothing and maybe it won't do it's default operation of clearing the background?
    Trinity: "Neo... nobody has ever done this before."
    Neo: "That's why it's going to work."
    c9915ec6c1f3b876ddf38514adbb94f0

  5. #5
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    How are you 'saving' what was currently on screen?

    Are you using double buffering?

    Need to draw to a Compatible DC and then BitBlt() that to the DC returned from BeginPaint() using the Rect in the paintstruct filled 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

  6. #6
    Registered User mrafcho001's Avatar
    Join Date
    Jan 2005
    Posts
    483
    Quote Originally Posted by novacain
    How are you 'saving' what was currently on screen?

    Are you using double buffering?

    Need to draw to a Compatible DC and then BitBlt() that to the DC returned from BeginPaint() using the Rect in the paintstruct filled by BeginPaint()
    NVM, i got it all

    I used a memory DC and HBITMAP to store everything i draw and then i move the bitmap from the Memory DC to the Screen DC, but i dont know how to draw the the bitmap to the screen.
    Last edited by mrafcho001; 09-05-2005 at 10:52 AM.
    My Website
    010000110010101100101011
    Add Color To Your Code!

  7. #7
    train spotter
    Join Date
    Aug 2001
    Location
    near a computer
    Posts
    3,868
    >>but i dont know how to draw the the bitmap to the screen.

    In the WM_PAINT BitBlt() your screen DC to the DC returned (or in the PAINTSTRUCT) from BeginPaint().

    Use the rect in the PAINTSTRUCT for the area to draw to.
    "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. Memory problem with Borland C 3.1
    By AZ1699 in forum C Programming
    Replies: 16
    Last Post: 11-16-2007, 11:22 AM
  2. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  3. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  4. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  5. Problem with Repaint();
    By peckitt99 in forum Windows Programming
    Replies: 0
    Last Post: 03-24-2007, 08:47 PM