FormBorderStyle.None and System Menu

S

Salem

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 right click on the form
button in the taskbar, (i guess that's because there is no titlebar or
control button).

Is there any way to display it, or better yet can i catch the right
click on the taskbar button and display my own app menu?

Thanks!
 
S

Salem

Salem said:
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 right click on the form
button in the taskbar, (i guess that's because there is no titlebar or
control button).

Is there any way to display it, or better yet can i catch the right
click on the taskbar button and display my own app menu?

Thanks!

I forgot to mention that i use C# :)
 
G

gerhard.stephan

Hi Salem,

as far as I know it's not possible show the system menu, because you
don't have a title bar in your winform.

But, there must be a way to modify the context menu. I can name you
many applications which shows a own context menu when clicking them in
taskbar.

I watch this thread because I'm interessted in that my self. Perhaps
some other guy has some more experience with that.

Wish you good luck
Cheers
Gerhard
 
J

Jocker

Hi,
you can override the CreateParams property of the borderless form with
this one:

const int WS_CLIPCHILDREN = 0x2000000;
const int WS_MINIMIZEBOX = 0x20000;
const int WS_MAXIMIZEBOX = 0x10000;
const int WS_SYSMENU = 0x80000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;

cp.Style = WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU;
cp.ClassStyle = CS_DBLCLKS;

return cp;
}
}

Jocker
 
S

Salem

Jocker said:
Hi,
you can override the CreateParams property of the borderless form with
this one:

const int WS_CLIPCHILDREN = 0x2000000;
const int WS_MINIMIZEBOX = 0x20000;
const int WS_MAXIMIZEBOX = 0x10000;
const int WS_SYSMENU = 0x80000;
const int CS_DBLCLKS = 0x8;
protected override CreateParams CreateParams
{
get
{
CreateParams cp = base.CreateParams;

cp.Style = WS_CLIPCHILDREN | WS_MINIMIZEBOX | WS_SYSMENU;
cp.ClassStyle = CS_DBLCLKS;

return cp;
}
}

Thank you very much, that did the trick! :)

Btw, can anyone tell me which message is sent when i left click on the
taskbar button of a form so i can intercept it in WndProc?

I have only one form visible in the taskbar but i have two separate forms.

I want to display all forms when the user loses focus and clicks on the
taskbar button and i think this would be the easiest way to do it.
 
S

Salem

Hi Salem,

as far as I know it's not possible show the system menu, because you
don't have a title bar in your winform.

But, there must be a way to modify the context menu. I can name you
many applications which shows a own context menu when clicking them in
taskbar.

I watch this thread because I'm interessted in that my self. Perhaps
some other guy has some more experience with that.

Wish you good luck
Cheers
Gerhard

Hi, Jocker posted a nice example of overriding CreateParams of a forms
and that did the trick (for the system menu at least ;)).
 

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