- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using a Win32 Visual Fortran program and drawing graphs to the window. However everytime I move the window or minize/maximize the inside of the window does not get redrawn. How can I handle this? Thanks.
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
It's hard to tell without seeing the code.
Windows whose window class has CS_VREDRAW.OR.CS_HREDRAW styles automatically receive a WM_PAINT when the window is resized. However, even without these styles, WM_PAINT should be generated when the window is enlarged (because enlarging creates an invalid region).
InvalidateRect API invalidates a rectangle in window's client area and generates a WM_PAINT message, but I suspect you have a problem elsewhere -- could you post some code?
Jugoslav
Windows whose window class has CS_VREDRAW.OR.CS_HREDRAW styles automatically receive a WM_PAINT when the window is resized. However, even without these styles, WM_PAINT should be generated when the window is enlarged (because enlarging creates an invalid region).
InvalidateRect API invalidates a rectangle in window's client area and generates a WM_PAINT message, but I suspect you have a problem elsewhere -- could you post some code?
Jugoslav
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Diskmon,
I suppose You should process the WM_PAINT message for the window that needs to be redrawn. Inside this message handler, perform all your drawing work into device context supplied by Windows (integer hDC=wParam). Every time the window is being redrawn by system, your program will redraw the window contents.
If You want to redraw your graphics without moving/resizing/e.t.c. (for example, if your graph data has changed), use InvalidateRect() API function (it incapsulates the WM_PAINT message, so you don't need to send it).
Do not use WM_PAINT message to redraw window contents. The system will not draw something on your window until there are no any invalidated rectangles.
Good luck!
I suppose You should process the WM_PAINT message for the window that needs to be redrawn. Inside this message handler, perform all your drawing work into device context supplied by Windows (integer hDC=wParam). Every time the window is being redrawn by system, your program will redraw the window contents.
If You want to redraw your graphics without moving/resizing/e.t.c. (for example, if your graph data has changed), use InvalidateRect() API function (it incapsulates the WM_PAINT message, so you don't need to send it).
Do not use WM_PAINT message to redraw window contents. The system will not draw something on your window until there are no any invalidated rectangles.
Good luck!

Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page