Windows Develop Bookmark and Share   
 index > Windows Forms General > Enforcing repaint in a form.
 

Enforcing repaint in a form.

I'm using a form for some simple animation using GDI. I use the Paint event but the form doesn't refresh on its own.

What should i do to refresh it atleast every second?

Code_Breaker  Thursday, November 29, 2007 7:05 AM

Override forms Paint event and call:

this.Invalidate(true);

This will repaints you complete form including the childs that are placed on that form

Bala Sekhar  Thursday, November 29, 2007 9:39 AM

In addition to calling the Invalidate() method, you might also try calling Update() which forces the control to redraw the invalidated areas rather than waiting for WM_PAINT message to arrive in the message queue.

Martin D. Randall  Thursday, November 29, 2007 10:31 AM

Override forms Paint event and call:

this.Invalidate(true);

This will repaints you complete form including the childs that are placed on that form

Bala Sekhar  Thursday, November 29, 2007 9:39 AM

In addition to calling the Invalidate() method, you might also try calling Update() which forces the control to redraw the invalidated areas rather than waiting for WM_PAINT message to arrive in the message queue.

Martin D. Randall  Thursday, November 29, 2007 10:31 AM

You can use google to search for other answers

Custom Search

More Threads

• Getting rid of the drop shadow in ToolStripMenuItems' DropDownCollection
• From MDIForm How can I execute a custom method in child form?
• Merged Menu Gap
• How to put different cell type in the same DataGridView column?
• Treeview Problem
• Regarding value of datagridviewcheckboxcell
• add controls dinamycally
• Want to validate datagrid cell input
• Key Events problem
• Webbrowser control ignores Disable Script Debugging when set in IE