Form Shrinking due to Non Client area introduction

G

Guest

I wanted to change the Non client area height. This was not possible in
the existing Form TitleBar. So I set the FormBorderStyle= None and I
calculated and introduced the Non Client area myself. So the height and width
of the Non Client area is 15 and 4 pixels border respectively. Also the
Nonclient area has been painted as per our need.
Now all is fine but in design time when the controls in the form
are anchored other than top, left. Now whenever the Formdesigner is closed
and opened the Form is shrinking by the above mentioned height and width. But
at runtime this is working fine.
I tried to set the third rectangle in the NCCALCSIZE structure but
this does not solve the problem. So if anyone has tried and have a solution
please let me know how can I solve the problem.
 
B

Bob Powell [MVP]

Are you doing this via the WndProc and handling the WM_NCCALCSIZE message or
have you somehow used the derived form at design time?

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

Bob Powell [MVP]

Remember also that you don't need to change the rectangle size if WMParam is
true.

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

I'm using the derived form at the design time. I have MyForm class which is
derived from the MS Form, which has its non client area changed as per my
needs. Now in my application i will have different forms with different
layouts all these are derived from the MyForm which will be available in the
library i have created.

public class Form1: MyForm // instead of MS Form
{
}

yes this is done via WndProc and Handling the WM_NCCALCSIZE message.

Harry
 

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