473,769 Members | 6,831 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Modifying windows layout(title bar)

I'm tryign to display my own title bar. I've created a window without one
but with a menu. The menu though is located in the upper left corner and I
need to move it down. I need to set the client windows location but I can't
seem to get the menu to move as it always starts at the upper left of the
form. I want basically to have the form work exactly like its suppose to but
implement my own title bar. i.e., I don't want to have to position the menu
manually as this is not done when I add a title bar to the form.

But no matter what I try the menu always just ends up in the starting in the
upper left corner. I'm sure I can set the menu's location manually but I
want it to use the same feature it does when windows handles the title bar.
I guess what I'm asking is how does window create a title bar for the form
so that the menu bar or client area does not interfer with it? If I set the
client area to be something 0 of the non-client area I still get the same
results.

i.e.

I create a class that inherits Windows.Forms.

I create a new property ClientRectangle that is suppose to override the
original so I can set it.

I then set it to be something such as (20,40,100,100) . Hence the menu
should, if this worked properly, paint itself in the client area and start
at 20,40 and not 0,0
What am I doing thats wrong? I just want to get the menu's location(the
upper right corner of the menu) to give me room to paint my title bar. But I
want to do this transparently and in the same fashion that windows does it.

Thanks,
Jon
Oct 5 '06 #1
3 2421
Jon Slaughter wrote:
I'm tryign to display my own title bar. I've created a window without one
but with a menu. The menu though is located in the upper left corner and I
need to move it down. I need to set the client windows location but I
can't seem to get the menu to move as it always starts at the upper left
of the form. I want basically to have the form work exactly like its
suppose to but implement my own title bar. i.e., I don't want to have to
position the menu manually as this is not done when I add a title bar to
the form.

But no matter what I try the menu always just ends up in the starting in
the upper left corner. I'm sure I can set the menu's location manually but
I want it to use the same feature it does when windows handles the title
bar.
I guess what I'm asking is how does window create a title bar for the form
so that the menu bar or client area does not interfer with it? If I set
the client area to be something 0 of the non-client area I still get the
same results.

i.e.

I create a class that inherits Windows.Forms.

I create a new property ClientRectangle that is suppose to override the
original so I can set it.

I then set it to be something such as (20,40,100,100) . Hence the menu
should, if this worked properly, paint itself in the client area and start
at 20,40 and not 0,0
What am I doing thats wrong? I just want to get the menu's location(the
upper right corner of the menu) to give me room to paint my title bar. But
I want to do this transparently and in the same fashion that windows does
it.

Thanks,
Jon
Hi Jon,

Now, I must admit I haven't used Windows for a while... but this is what I
can remember. The menu is part of the non-client area; because it's a
non-client feature. What you should be doing is leaving the Windows
title-bar in, but painting over it. For this, you need to capture the
WM_NCPAINT window message, and act on it accordingly. It's a non-trivial
process though, and you may want to look around the internet for examples
to do with painting in the non-client area.

Once you get your painting sorted out, IIRC there's a Windows API you can
use to adjust the size of the non-client area, which is certainly what
you'll need to use if your title-bar is not the same size as the standard
windows title-bar.

I did a bit of Googling, and found you this:
http://www.codeplex.com/Wiki/View.as...omerBorderForm

It may be a useful starting point.

Good Luck!

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 5 '06 #2

"Tom Spink" <ts****@gmail.c omwrote in message
news:eX******** ******@TK2MSFTN GP04.phx.gbl...
Jon Slaughter wrote:
>I'm tryign to display my own title bar. I've created a window without one
but with a menu. The menu though is located in the upper left corner and
I
need to move it down. I need to set the client windows location but I
can't seem to get the menu to move as it always starts at the upper left
of the form. I want basically to have the form work exactly like its
suppose to but implement my own title bar. i.e., I don't want to have to
position the menu manually as this is not done when I add a title bar to
the form.

But no matter what I try the menu always just ends up in the starting in
the upper left corner. I'm sure I can set the menu's location manually
but
I want it to use the same feature it does when windows handles the title
bar.
I guess what I'm asking is how does window create a title bar for the
form
so that the menu bar or client area does not interfer with it? If I set
the client area to be something 0 of the non-client area I still get
the
same results.

i.e.

I create a class that inherits Windows.Forms.

I create a new property ClientRectangle that is suppose to override the
original so I can set it.

I then set it to be something such as (20,40,100,100) . Hence the menu
should, if this worked properly, paint itself in the client area and
start
at 20,40 and not 0,0
What am I doing thats wrong? I just want to get the menu's location(the
upper right corner of the menu) to give me room to paint my title bar.
But
I want to do this transparently and in the same fashion that windows does
it.

Thanks,
Jon

Hi Jon,

Now, I must admit I haven't used Windows for a while... but this is what I
can remember. The menu is part of the non-client area; because it's a
non-client feature. What you should be doing is leaving the Windows
title-bar in, but painting over it. For this, you need to capture the
WM_NCPAINT window message, and act on it accordingly. It's a non-trivial
process though, and you may want to look around the internet for examples
to do with painting in the non-client area.
I thoguht about that but then I thought that it would be a waste and my
non-client area generated from the title bar would be fixed to what ever the
size of the title bar is.
Once you get your painting sorted out, IIRC there's a Windows API you can
use to adjust the size of the non-client area, which is certainly what
you'll need to use if your title-bar is not the same size as the standard
windows title-bar.
Why not just use that API without the form having at title bar? If the menu
is working in the NC area then there must be a way to move it because this
is exactly what windows does behind the scenes anyways.
I did a bit of Googling, and found you this:
http://www.codeplex.com/Wiki/View.as...omerBorderForm

It may be a useful starting point.
Thanks, looks like it might contain what I need
Jon
Oct 5 '06 #3
Jon Slaughter wrote:
>
"Tom Spink" <ts****@gmail.c omwrote in message
news:eX******** ******@TK2MSFTN GP04.phx.gbl...
>Jon Slaughter wrote:
>>I'm tryign to display my own title bar. I've created a window without
one but with a menu. The menu though is located in the upper left corner
and I
need to move it down. I need to set the client windows location but I
can't seem to get the menu to move as it always starts at the upper left
of the form. I want basically to have the form work exactly like its
suppose to but implement my own title bar. i.e., I don't want to have to
position the menu manually as this is not done when I add a title bar to
the form.

But no matter what I try the menu always just ends up in the starting in
the upper left corner. I'm sure I can set the menu's location manually
but
I want it to use the same feature it does when windows handles the title
bar.
I guess what I'm asking is how does window create a title bar for the
form
so that the menu bar or client area does not interfer with it? If I set
the client area to be something 0 of the non-client area I still get
the
same results.

i.e.

I create a class that inherits Windows.Forms.

I create a new property ClientRectangle that is suppose to override the
original so I can set it.

I then set it to be something such as (20,40,100,100) . Hence the menu
should, if this worked properly, paint itself in the client area and
start
at 20,40 and not 0,0
What am I doing thats wrong? I just want to get the menu's location(the
upper right corner of the menu) to give me room to paint my title bar.
But
I want to do this transparently and in the same fashion that windows
does it.

Thanks,
Jon

Hi Jon,

Now, I must admit I haven't used Windows for a while... but this is what
I
can remember. The menu is part of the non-client area; because it's a
non-client feature. What you should be doing is leaving the Windows
title-bar in, but painting over it. For this, you need to capture the
WM_NCPAINT window message, and act on it accordingly. It's a non-trivial
process though, and you may want to look around the internet for examples
to do with painting in the non-client area.

I thoguht about that but then I thought that it would be a waste and my
non-client area generated from the title bar would be fixed to what ever
the size of the title bar is.
>Once you get your painting sorted out, IIRC there's a Windows API you can
use to adjust the size of the non-client area, which is certainly what
you'll need to use if your title-bar is not the same size as the standard
windows title-bar.

Why not just use that API without the form having at title bar? If the
menu is working in the NC area then there must be a way to move it because
this is exactly what windows does behind the scenes anyways.
>I did a bit of Googling, and found you this:
http://www.codeplex.com/Wiki/View.as...omerBorderForm

It may be a useful starting point.

Thanks, looks like it might contain what I need
Jon
Hi Jon,
Why not just use that API without the form having at title bar? If the
menu is working in the NC area then there must be a way to move it because
this is exactly what windows does behind the scenes anyways.
You may be absolutely right... I can't try it out, so if you do, let us know
how it turns out.

--
Hope this helps,
Tom Spink

Google first, ask later.
Oct 5 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
3198
by: Picho | last post by:
Hi all, Is there any .NET way (I am not rulling out API usage) to add button(s) to a form's title bar? I found some non-.NET solutions that did actually work in VB6 but not in the ..NET forms... I tried painting, but the paintaing area provided by the form is only the client area - no visible way to paint on the title bar.
19
6010
by: Lauren Quantrell | last post by:
In Windows XP display Properties/Appearance users can chose between: Windows XP Style or Windows Classic Style. Is there a way in VBA to determine the user's selection? The reason: Toolbars size taller in XP than in Classic so I need to size all those nifty windows sizing commands depending on the user's preference.
0
1030
by: Mark Heathcote | last post by:
can anyone give me some pointers? Q1 - how can i monitor the system (XP) and detect when a dial up has occured via modem and return the connection speed? (I want to be able to prompt when speeds lower than say 30k are detected. This is to trap bad dial ups and connections via mobile phones) Q2 - I also want to monitor the current active window and log the title out to a file, e.g. to produce a log file showing the sequence of applications...
0
995
by: Maruko | last post by:
I can see in much software as photoshop all its toolbar property and others child window are active if the main is active and are inactive if the main is not. How can i fake the windows message to avoid to draw the titlebar of childs inactive when i click on the main? Thanks.
2
1810
by: Bilal Dhavan | last post by:
I am using ASP.Net with .Net Framework 1.1. I want to display account number in the windows title bar. The data that I am going to display will be from server side control (txtAcountNo.text). I can use the following statement to display the title.
2
8391
by: Max | last post by:
Hello, Is there a way to determine the size (height) of a windows title bar? I am trying to position a window of an application so that the top edge of the window aligns with the top edge of a panel in my form. When I position the application window in code, it positions correctly, except the bottom edge of the application's title bar appears at the top of
1
3364
by: Chad Miller | last post by:
How do I get the size of a window (form) title bar? - Chad chad@predictiveconcepts.com
2
2259
by: DBC User | last post by:
I would like to have some words in the form title as italic (only some), is it possible to do it? If so could someone give me some pointers? Thanks.
0
1196
by: oded55 | last post by:
Hi, I'd like to be able to change the right click options i am getting regardless of what is the application running, right click today has the followiing options Restore, Move size etc.... is there a way to do this using c# or somehow else? Thanks,
0
9590
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
9424
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
10223
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9866
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8879
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...
0
6675
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
5310
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
5448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2815
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.