473,248 Members | 1,333 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,248 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 2847
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
by: Jason Rodman | last post by:
I have standard winform that I have hidden the title bar so that I can make my own custom header. I have my own code to drag the form and close/minimize/maximize and even show the title in the task...
2
by: Rafi Zisman | last post by:
Hi I have a problem with menu and FormBorderStyle = None: I opened new C# project and set the property FormBorderStyle = None , And added main menu. When I run the application and on the last...
4
by: trint | last post by:
Ok, I received info that this will work as a means of removing the border around a window that I create (which also loads an aspx file) in the firing file (aspx using javascript): OpenWindow =...
2
by: iwdu15 | last post by:
hi, how can i make my windows form not show the start menu or any menu for that matter so it will essentially be full screen?
2
by: Sharon | last post by:
In the Form there is the Control/System menu. I wish to prevent this system menu from poping-up although the minimize, maximize and close buttons is still shown on the Form caption bar. How can...
5
by: Boki | last post by:
Hi All, I am using webbrowser control, it is very often to happen: A first chance exception of type 'System.IO.FileNotFoundException' occurred in System.Windows.Forms.dll but sometimes...
5
by: Salem | last post by:
Hi! I have a problem. When i set FormBorderStyle property of a form to None i can't get the system menu (that windows menu with close, maximize, minimize and other options) to show up when i...
5
by: ThunderMusic | last post by:
Hi I'm currently developping a skinnable form by using a borderless form (Form.FormBorderStyle=None). Is it the right way to go in the first place? if it is. Assuming that when there is no border...
3
tlhintoq
by: tlhintoq | last post by:
I'm running Window7 64bit, RTM. To give this application the ability to switch between a moveable frame and no frame I am using the following methods void Fixed() { Point pBefore =...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
0
Git
by: egorbl4 | last post by:
Скачал я git, хотел начать настройку, а там вылезло вот это Что это? Что мне с этим делать? ...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...

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.