By overriding of the method
OnPaint
in the derived class. If you need more room for this declaration, you would also need to adjust the client size using y overriding the method
SetClientSizeCore
.
Please see:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.onpaint.aspx[
^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.setclientsizecore.aspx[
^].
Instead of overriding of the method
OnPaint
you can also handle the event
Paint
, but it makes not much sense if you have to create a derived class anyway:
http://msdn.microsoft.com/en-us/library/system.windows.forms.control.paint.aspx[
^].
When rendering, don't repeat a common mistake: don't create an instance of the class
System.Drawing.Graphics
, instead, use the one passed in the event argument parameter.
—SA