OnPaint vs Paint

Paint is the event in which a consumer of your control (form etc containing your control) can react to your control drawing itself. Paint is an Event and as such requires an event handler (delegate) to be connected.
OnPaint is a method rather than an event - you would normally override the OnPaint method in a control if you are inheriting from a parent control (nearly always the case as you would normally inherit from Control or a derivative of Control), performing the relevant drawing code there. If you are using OnPaint then calling base.OnPaint will call all the base class drawing code and invoke any attached event handlers.
 
oh
so basically with Paint, if you (for example) resize the form, itll redraw itself automatically
whereas with OnPaint, it wouldnt do this becuase it wouldnt react to the conrol drawint itself?

pent
 
Back
Top