Restricting the 'paintable' areas of a control

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Is there any way to restrict the area in a control that can be painted? For
example, if I wanted to enforce a three-pixel wide border around my control,
how would I go about it?

Thanks
 
For borders you should consider responding to the non-client messages such
as WM_NCCREATE and WM_NCPAINT. These allow you to set a client size that is
different from the overall control size.

For other painting issues you can use clipping regions to limit the output
of graphics to certain areas.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Back
Top