473,467 Members | 1,291 Online
Bytes | Software Development & Data Engineering Community
Create 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 2405
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.comwrote in message
news:eX**************@TK2MSFTNGP04.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.comwrote in message
news:eX**************@TK2MSFTNGP04.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
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...
19
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...
0
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...
0
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...
2
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)....
2
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...
1
by: Chad Miller | last post by:
How do I get the size of a window (form) title bar? - Chad chad@predictiveconcepts.com
2
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
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.... ...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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,...
0
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...
0
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,...
0
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...
0
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...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
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 ...

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.