By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
428,558 Members | 1,607 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 428,558 IT Pros & Developers. It's quick & easy.

Form Shrinking due to Non Client area introduction

P: n/a
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.
Nov 9 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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.

"Harry_Crow" <Ha*******@discussions.microsoft.comwrote in message
news:FD**********************************@microsof t.com...
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.

Nov 9 '06 #2

P: n/a
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.

"Harry_Crow" <Ha*******@discussions.microsoft.comwrote in message
news:FD**********************************@microsof t.com...
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.

Nov 9 '06 #3

P: n/a
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

"Bob Powell [MVP]" wrote:
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.

"Harry_Crow" <Ha*******@discussions.microsoft.comwrote in message
news:FD**********************************@microsof t.com...
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.


Nov 14 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.