473,847 Members | 1,490 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 4183
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*******@disc ussions.microso ft.comwrote in message
news:FD******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.comwrote in message
news:FD******** *************** ***********@mic rosoft.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*******@disc ussions.microso ft.comwrote in message
news:FD******** *************** ***********@mic rosoft.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
1612
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 at 7:00 p.m. and usually last approximately 2 hours. If attending the meeting by Metro, get off the Dupont Circle stop and walk north to Florida Avenue...turn right. There is no cost associated with attending but if you are planning on...
11
18852
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 they are too big and wind up covering up some of the fields on the main form. Is there any good code out there that works in a similar fashion that will also either a) stretch the form width wise on widescreens or b), rely on height rather than...
3
2562
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 tried various mouse move/leave event handling scenario's involving the form or the controls on it's client area but no
7
2626
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
3442
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 PrimaryScreen and the WorkingArea properties. Dim workingRectangle As System.Drawing.Rectangle = _ Screen.PrimaryScreen.WorkingArea ' Set the size of the form slightly less than size of
2
1571
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 have reported that the server is running out of disk space and examination shows that the log files for several of the databases are at 5Gb or more. After reading around the subject I suggested the following sequence of operations:
4
9248
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 areas). This means that if the mouse is currently inside the form's client area and it enters a child, a MouseLeave event will be generated on the form. One little trick to overcome this is to do a point-in-rectangle test inside the MouseLeave...
1
3063
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 way. Form's ClientRectangle is readonly. How can I set the client rectangle size? Theoretically, if I could get height and width of non-client area, then I will be able add those margins when I set the form's Size. But I don't know if this is the...
4
2957
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 programmatically tell whether or not a form is opened in Tabbed or Overlapping mode? I tried using Application.GetOption("Document Window Options")
0
9892
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9734
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10656
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9495
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7889
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7061
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5730
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5915
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4541
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system

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.