473,386 Members | 1,708 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,386 software developers and data experts.

How do you control the system menu on a form with no title bar

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 bar (since the
text property needs to be blank to hide the title also).

My question is, how do i make the system menu show from the task bar when
the user right-clicks on the task bar icon? Since the controlbox property
needs to be false in order to hide the title bar, it unfortunately disables
the system menu from the task bar too. Any ideas?
Nov 22 '05 #1
6 2389
The example on my site shows how to add the system menu to a borderless
form.
http://dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
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 bar (since the
text property needs to be blank to hide the title also).

My question is, how do i make the system menu show from the task bar when
the user right-clicks on the task bar icon? Since the controlbox property
needs to be false in order to hide the title bar, it unfortunately
disables
the system menu from the task bar too. Any ideas?

Nov 22 '05 #2
Here is my problem though... I want to keep the 3d border on, so the
FormBorderStyle cannot be turned off. To hide the header i have to turn off
the controlbox property, which causes your code to show the system menu to no
longer work. A good example of what im looking for is Microsoft Money 2005.

"Mick Doherty" wrote:
The example on my site shows how to add the system menu to a borderless
form.
http://dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
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 bar (since the
text property needs to be blank to hide the title also).

My question is, how do i make the system menu show from the task bar when
the user right-clicks on the task bar icon? Since the controlbox property
needs to be false in order to hide the title bar, it unfortunately
disables
the system menu from the task bar too. Any ideas?


Nov 22 '05 #3
You only needed a very slight modification of the CreateParams method.

\\\
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const WS_MINIMIZEBOX As Integer = &H20000
Const WS_MAXIMIZEBOX As Integer = &H10000
Const WS_SYSMENU As Integer = &H80000
cp.Style = cp.Style Or WS_MINIMIZEBOX Or _
WS_SYSMENU Or WS_MAXIMIZEBOX
Return cp
End Get
End Property
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Here is my problem though... I want to keep the 3d border on, so the
FormBorderStyle cannot be turned off. To hide the header i have to turn
off
the controlbox property, which causes your code to show the system menu to
no
longer work. A good example of what im looking for is Microsoft Money
2005.

"Mick Doherty" wrote:
The example on my site shows how to add the system menu to a borderless
form.
http://dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
>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 bar (since
> the
> text property needs to be blank to hide the title also).
>
> My question is, how do i make the system menu show from the task bar
> when
> the user right-clicks on the task bar icon? Since the controlbox
> property
> needs to be false in order to hide the title bar, it unfortunately
> disables
> the system menu from the task bar too. Any ideas?


Nov 22 '05 #4
That worked great, but i noticed the close menu option is disabled. Any ideas?

"Mick Doherty" wrote:
You only needed a very slight modification of the CreateParams method.

\\\
Protected Overrides ReadOnly Property CreateParams() As CreateParams
Get
Dim cp As CreateParams = MyBase.CreateParams
Const WS_MINIMIZEBOX As Integer = &H20000
Const WS_MAXIMIZEBOX As Integer = &H10000
Const WS_SYSMENU As Integer = &H80000
cp.Style = cp.Style Or WS_MINIMIZEBOX Or _
WS_SYSMENU Or WS_MAXIMIZEBOX
Return cp
End Get
End Property
///

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:A8**********************************@microsof t.com...
Here is my problem though... I want to keep the 3d border on, so the
FormBorderStyle cannot be turned off. To hide the header i have to turn
off
the controlbox property, which causes your code to show the system menu to
no
longer work. A good example of what im looking for is Microsoft Money
2005.

"Mick Doherty" wrote:
The example on my site shows how to add the system menu to a borderless
form.
http://dotnetrix.co.uk/misc.html --> An example of a moveable/resizable
shaped form.

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
"Jason Rodman" <Ja*********@discussions.microsoft.com> wrote in message
news:80**********************************@microsof t.com...
>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 bar (since
> the
> text property needs to be blank to hide the title also).
>
> My question is, how do i make the system menu show from the task bar
> when
> the user right-clicks on the task bar icon? Since the controlbox
> property
> needs to be false in order to hide the title bar, it unfortunately
> disables
> the system menu from the task bar too. Any ideas?


Nov 22 '05 #5
Leave the controlbox set to true at design time and remove the WS_CAPTION
style instead of adding the System Menu.
The text property will then no longer need to be blank and the Taskbar
window will show the Text.
http://msdn.microsoft.com/library/de...dow_styles.asp

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html
Nov 22 '05 #6
That worked beautifully. Thanks.

"Mick Doherty" wrote:
Leave the controlbox set to true at design time and remove the WS_CAPTION
style instead of adding the System Menu.
The text property will then no longer need to be blank and the Taskbar
window will show the Text.
http://msdn.microsoft.com/library/de...dow_styles.asp

--
Mick Doherty
http://dotnetrix.co.uk/nothing.html

Nov 22 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: zapazap | last post by:
Dear Snake Charming Gurus, (Was: http://mail.python.org/pipermail/python-list/2004-January/204454.html) First, a thank you to Tim Golden, Thomas Heller, and Mark Hammond for your earlier help...
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...
0
by: Duncan Mole | last post by:
Hi, I have created a control which draws a title bar and provides a drop down menu for a Smart Device Application. It seemed to work fine until I came to add an event handler to act on Paint...
7
by: moondaddy | last post by:
I have a user control being used instead of a frame page. when the user clicks on a menu item I need to send the ID (integer value) of that menu as a parameter in the postback of the user control...
5
by: Marcel Gelijk | last post by:
Hi, I am trying to create a User Control that is located in a seperate class library. The User Control contains a textbox and a button. The page generates an exception when it tries to access...
0
by: RSB | last post by:
Hi Every one, i am trying to create a UserControl and i am passing a Array of strings to it. Now based on the Array elements i am creating the LinkButtons Dynamically. I am also passing a Event to...
0
by: Rob | last post by:
I want to feed the menu control from a database which is set up as WebPageID, WebPageParent, URL where the WebPage Id is the primary key and the WebpageParent is the foreign key. The menu will...
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...
11
by: -D- | last post by:
How can I turn the visibility of the xml control on or off? <%@ Control Language="c#" AutoEventWireup="false" Codebehind="TopNavBar.ascx.cs" Inherits="compass.user_controls.TopNavBar"...
2
by: John Smith | last post by:
I am trying to use the menu control for a tabbed menu system but it's frustrating the hell out of me. The full code is listed below. The trouble that I'm having is that, when the user clicks on a...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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.