Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

What is form_paint used for? 1

Status
Not open for further replies.

peter11

Instructor
Mar 16, 2001
334
US
I am currently using a program that uses both form_load and form_paint. What is the difference and why do you need to use both?

Thanks
 
The Form Paint event is useful when you have output from graphics programs in your code. With a Paint procedure, you can ensure that such output is repainted when necessary.

If e.g. you want a gradient color for the Background of a form, you can draw this gradient in the Paint Event.

The Paint Event is invoked when the Refresh method is used. It the AutoRedraw property is set to True, repainting or redrawing is automatic and Paint events are not necessary.

In principle, you Load the form only once because this is a resource consuming operation. The form stays in memory until you Unload it. During this time you can possibly Hide it.

If you want to change any of the graphics on the form, there is no need to Load the form again.
The Paint event is the most appropriate place to do so. _________________________________
In theory, there is no difference between theory and practice. In practice, there is. [attributed to Yogi Berra]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top