How do you limit a Form's container area without changing the sze?

G

Guest

Basically I have a form that is 400w and 400h in pixels. I want all children
added (either by the designer or programatically) to be layed out within say
a 300w x 300h sub area, so that the outlying 100x100 pixels are ignored as a
container but still available for me to paint on.

Make sense? I basically want to create the concept of client size but within
the client area, so a sub-client area..
 
B

Bob Powell [MVP]

You could either handle the WM_NCCREATE message and change the relationship
of the client size to the window size or write a custom layout manager that
re-arranges your controls according to your needs.

If you go for the former you can override WM_NCPAINT too. This will enable
you to draw in the 100 pixel non-client borderarea.

--
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.
 
G

Guest

Thanks for the tip on WM_NCCREATE. Regarding doing painting in the NC area, I
am highly dubious since I've never been able to figure out how to make it
work 100% of the time. I often see anomolies where the regular windows
painting routines leak through in certain areas of the titlebar, and I see
this even in professional skinning products like WindowsBlinds. I just don't
trust the technique.

That is why I'm trying to create my own custom non client area.
 

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