Re: Modifying windows layout(title bar)

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



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.aspx?ProjectName=CustomerBorderForm

It may be a useful starting point.

Good Luck!

--
Hope this helps,
Tom Spink

Google first, ask later.
.



Relevant Pages

  • Re: Modifying windows layout(title bar)
    ... The menu though is located in the upper left corner ... I need to set the client windows location but I ... suppose to but implement my own title bar. ... the client area to be something> 0 of the non-client area I still get ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Modifying windows layout(title bar)
    ... I need to set the client windows location but I ... suppose to but implement my own title bar. ... the client area to be something> 0 of the non-client area I still get ...
    (microsoft.public.dotnet.languages.csharp)
  • Modifying windows layout(title bar)
    ... I'm tryign to display my own title bar. ... The menu though is located in the upper left corner and I ... want it to use the same feature it does when windows handles the title bar. ... client area to be something> 0 of the non-client area I still get the same ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: "My Computer" missing in "Look In" dialogue box
    ... Places bar is on the left in this picture... ... and folders in the selected location will be listed at the right.]] ... Edit the Places bar locations in Open Save As common dialog boxes ... Microsoft PowerToys for Windows XP ...
    (microsoft.public.windowsxp.general)
  • Re: "My Computer" missing in "Look In" dialogue box
    ... It is Windows XP, but Office 2002. ... To add My Computer to the My Places bar, ... and the files and folders in the selected location will be ... Edit the Places bar locations in Open Save As common dialog boxes ...
    (microsoft.public.windowsxp.general)