473,385 Members | 1,597 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 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 4139
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Betty Harvey | last post by:
The next meeting of the XML Users Group will be held on Wednesday, April 21, 2004 at the American Geophysical Union (AGU) at 2000 Florida Avenue, N.W., Washington, DC 20009-1277. The meeting starts...
11
by: Jozef | last post by:
I have some old code that I use from the Access 95 Developers handbook. The code works very well, with the exception that it doesn't seem to recognize wide screens, and sizes tab controls so that...
3
by: AinO | last post by:
Hi, (VS2003/c# - System.Windows.Forms) Is there a way to know (have an event triggered) if the mouse leaves a form, if this form's client area is completly covered with child controls ? I...
7
by: Georges Bessis | last post by:
The image I set as background are left at original size. In a picturebox, I can decide to strech the image. Can I do that to fill my background ? Regards GB
14
by: Galen Somerville | last post by:
My current screen resolution is set to 1024 x 768. My form size always comes up as 1032 x 748. I have tried the help sample ' Retrieve the working rectangle from the Screen class ' using the...
2
by: William | last post by:
I've been tasked with taking over the support for a client's SQL Server database. I'm not a DBA by profession, I'm a software developer who uses SQL Server as a database designer. The clients...
4
by: cb.brite | last post by:
Hello, I have tried this using the MouseEnter/MouseLeave events. However these events do not really refer to the rectangular shape of the form, but the client area (form area minus children...
1
by: Sin Jeong-hun | last post by:
I need to set the form's client rectangle to a specific size. But Form's Size property seems to include non-client area. Since non-client area size varies depending on yours system, I need another...
4
by: Peter | last post by:
Access 2007 optionally opens forms as tabs. There is an Access Option that controls this - Access Options Current Database Document Window Options Tabbed Documents. But how, from VBA, can I...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.