Why should I provide a Non-Client border to my Control derived class?

Started by nandagopal, Jul 10, 2008, 07:42 PM

Previous topic - Next topic

nandagopal

Providing a border in the non-client region of your control rather than in the ClientRectangle has very many advantages:
# When you include a scrollbar in your control, the scrollbar will appear inside the border, rather than to the outside if you drew the border in the client area.
# When you allow custom painting of the control, your user will not draw over the NC border.
# Your own client painting code will be simplified in that you will not have to bother about taking the border into account while painting the client area.
The next faq will tell you how to include a non-client border.