How can change the bounds of the client area of a control ?

S

Steph.

How can change the bounds of the client area of a control ?



In fact I would like to have a Panel with Raised borders. I can draw the raised borders but they disappears as soon as I put control inside with it's Dock property set to DockStyle.Fill.





I tried using the "SetClientSizeCore" of my derived Panel..but it doesn't work...



Any help is greatly appreciated !!



Thanks,



Steph.
 
T

Tim Wilson

You'd be best to have the border be treated as non-client area. Try
adjusting the border style using the "GetWindowLong" and "SetWindowLong"
Win32 APIs. You should be able to get what you need at
http://www.pinvoke.net/

--
Tim Wilson
..NET Compact Framework MVP

How can change the bounds of the client area of a control ?



In fact I would like to have a Panel with Raised borders. I can draw the
raised borders but they disappears as soon as I put control inside with it's
Dock property set to DockStyle.Fill.





I tried using the "SetClientSizeCore" of my derived Panel..but it doesn't
work...



Any help is greatly appreciated !!



Thanks,



Steph.
 
B

Bob Powell [MVP]

You need to handle the WM_NCPAINT and WM_NCCALCSIZE messages directly. You can change the size and position of the client area within the control and paint your own custom borders.

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

Ramuseco Limited .NET consulting
http://www.ramuseco.com

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.





How can change the bounds of the client area of a control ?



In fact I would like to have a Panel with Raised borders. I can draw the raised borders but they disappears as soon as I put control inside with it's Dock property set to DockStyle.Fill.





I tried using the "SetClientSizeCore" of my derived Panel..but it doesn't work...



Any help is greatly appreciated !!



Thanks,



Steph.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top