| |

VerySource

 Forgot password?
 Register
Search
View: 660|Reply: 4

Discuss repainting

[Copy link]

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-3-13 06:30:01
| Show all posts |Read mode
Invalidate ();
And call directly
CDC * pDC = GetDC ();
OnDraw (pDC);
What's the difference? (The paintings are all drawn in OnDraw, not elsewhere)
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-6-8 17:15:01
| Show all posts
The use of Invalidate () is a formal practice, whether to call OnDraw is determined by the system, because the window can be hidden and can be minimized. Calling OnDraw (pDC) is your own control, not a formal practice.
Reply

Use magic Report

0

Threads

4

Posts

5.00

Credits

Newbie

Rank: 1

Credits
5.00

 China

Post time: 2020-6-9 21:00:01
| Show all posts
Invalidate() should trigger WM-PAINT message conditionally, so OnDraw executes in the message response function. It is an indirect call to OnDraw, which is more control than calling OnDraw (pDC).
Reply

Use magic Report

1

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

 Author| Post time: 2020-8-3 17:45:01
| Show all posts
Haha, I actually want to know the difference in the timeliness of their calls. I called onDraw and felt that it didn't help me refresh the interface.
And calling invalidate is too late to refresh.
Reply

Use magic Report

0

Threads

22

Posts

18.00

Credits

Newbie

Rank: 1

Credits
18.00

 Invalid IP Address

Post time: 2020-8-3 19:00:01
| Show all posts
InvalidatedRect
To invalidate a rectangle, the rectangle needs to be redrawn, and a redraw mark is made on the rectangle. When the next WM_PAINT is issued, the rectangle is redrawn.
Make the display rectangular area invalid, WM_PAINT will redraw the invalid area
The parameter TRUE in the function means that the system will cover the selected area with the background color once before you draw. The default background color is white. You can change the background color by setting BRUSH.

UpdateWindow
Force a WM_PAINT message
Will send a WM_PAINT, but do not enter the message queue, call to update the window immediately
Only send WM_PAINT message to the form, before sending, judge GetUpdateRect(hWnd,NULL,TRUE) to see if there is a client area that can be drawn, if not, don’t send WM_PAINT

If you want to refresh the invalid area immediately, you can call UpdateWindow after calling InvalidateRect. If any part of the client area is invalid,
Then UpdateWindow will cause Windows to call the window procedure with the WM_PAINT message (if the entire client area is valid, the window procedure is not called).
This WM_PAINT message does not enter the message queue, and the window procedure is directly called by WINDOWS. Exit immediately after the window process is refreshed,
WINDOWS returns control to the statement after the UpdateWindow call in the program.
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list