Thread: losing an object when scrolling

  1. #1
    mr ed

    losing an object when scrolling

    I've created an mdi in visual c++ 6 and have set the document to be the size of an a3 page. I've drawn a crect wherever the mouse is pressed. But when I scroll the crect disappears. I've use the DPtoLP function to change the CPoint when drawing the crect and have stored those CPoints in an array. I've also added code in the Ondraw function that is supposed to redraw the crect whenever scrolling occurs but it doesn't seem to work.

  2. #2
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    I've not used MSVC or MFC. I use OWL and the API but it sounds like the class that controls your MDI child window is not intercepting the WM_PAINT message which would signal it to repaint. Also, make sure that you are telling Windows that you do not want it to automatically repaint your window since you will be painting it. If you don't, then this will cause your window to flicker.

    Your info is probably disappearing because Windows is redrawing the window and erasing your object. Since your child window is not being repainted by it's class due to the WM_PAINT not being intercepted correctly, the object is not redrawn.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. using this as synchronization object
    By George2 in forum C# Programming
    Replies: 0
    Last Post: 03-22-2008, 07:49 AM
  2. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  3. Replies: 60
    Last Post: 12-20-2005, 11:36 PM
  4. Question on l-values.
    By Hulag in forum C++ Programming
    Replies: 6
    Last Post: 10-13-2005, 04:33 PM
  5. A question about constructors...
    By Wolve in forum C++ Programming
    Replies: 9
    Last Post: 05-04-2005, 04:24 PM