471,610 Members | 1,312 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,610 software developers and data experts.

Form Shrinking due to Non Client area introduction

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
3 4028
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
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
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.

Similar topics

11 posts views Thread by Jozef | last post: by
3 posts views Thread by AinO | last post: by
14 posts views Thread by Galen Somerville | last post: by
1 post views Thread by Sin Jeong-hun | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by MichaelMortimer | last post: by
1 post views Thread by ZEDKYRIE | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.