473,387 Members | 1,721 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,387 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 2852
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 =...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.