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

G

Guest

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?
 
G

Guest

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.
 
M

Mick Doherty

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
///
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top