How can I open a window's system menu by code?

后端 未结 3 941
-上瘾入骨i
-上瘾入骨i 2021-01-06 06:13

I have a C# WinForms borderless window, for which I override WndProc and handle the WM_NCHITTEST message. For an area of that form, my hit test function returns HTSYSMENU. D

3条回答
  •  渐次进展
    2021-01-06 06:58

    I have the same properties in my application and Right click doesn't work either, so this is not your problem, it appears to be the way windows forms respond when they have no border.

    If you set your border to the normal value, you will be able to have right click in the taskbar and such.

    For right click on other controls, you'll need to set the ContextMenuStrip and provide your "menu". But I'm not sure if this works when you have it without border. I have been unable to make it work.

提交回复
热议问题