471,605 Members | 1,595 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,605 software developers and data experts.

Add system menu to form with FormBorderStyle = None

Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?
Jan 24 '06 #1
5 2782
Mark,

I haven't tried this, but you could call the GetSystemMenu API through
the P/Invoke layer. This will return the handle to the system menu for the
window to you.

Once you have that, you can pass the handle to the TrackPopupMenu or
TrackPopupMenuEx API function, again through the P/Invoke layer.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?

Jan 24 '06 #2
"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?


The shaped form example on my site includes a Sytem Menu, you should be able
to extract what you need from it.
http://www.dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Jan 24 '06 #3
Mick Doherty wrote:
"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?

The shaped form example on my site includes a Sytem Menu, you should be able
to extract what you need from it.
http://www.dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.


Thats great, thanks for both replies.

Jan 25 '06 #4
Mick Doherty wrote:
"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?

The shaped form example on my site includes a Sytem Menu, you should be able
to extract what you need from it.
http://www.dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

On your page you say:

"With a little InterOp you can draw a standard TitleBar onto which you
can place custom buttons, and this solution is much simpler than that of
OwnerDrawing the NonClient Area to achieve the same effect. "

How can i draw the minimise, maximise, close etc, buttons? Where are
they stored?
Jan 25 '06 #5
Depends on how you want to draw them.
Non Visual Styled Caption Buttons can be drawn via the ControlPaint class.
Visual Styled buttons need to drawn with Interop using OpenThemeData(),
DrawThemeBackground(), CloseThemeData(). The definitions are stored in the
header files 'uxtheme.h' and 'Tmschema.h' or you may find them on
www.pinvoke.net

There may be ways to draw Visual Styled buttons without Interop in VS2005,
but I can't confirm this as I don't have it.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Mark Ingram" <no****@nowhere.com> wrote in message
news:u3*************@tk2msftngp13.phx.gbl...
Mick Doherty wrote:
"Mark Ingram" <no****@nowhere.com> wrote in message
news:%2****************@TK2MSFTNGP09.phx.gbl...
Hi, ive got a form with FormBorderStyle set to None (i am using custom
regions to determine the shape of the form). But i would like to be able
to display the standard system menu when the user right clicks the
application in the taskbar. How can i do this?

The shaped form example on my site includes a Sytem Menu, you should be
able to extract what you need from it.
http://www.dotnetrix.co.uk/misc.html --> An example of a
moveable/resizable shaped form.

On your page you say:

"With a little InterOp you can draw a standard TitleBar onto which you can
place custom buttons, and this solution is much simpler than that of
OwnerDrawing the NonClient Area to achieve the same effect. "

How can i draw the minimise, maximise, close etc, buttons? Where are they
stored?

Jan 25 '06 #6

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Rafi Zisman | last post: by
2 posts views Thread by iwdu15 | last post: by
5 posts views Thread by Salem | last post: by
1 post views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by CCCYYYY | last post: by

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.