Click here to Skip to main content
16,019,018 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi...

I want to remove system menu from the title bar

Restore
Maximize
Minimize
Move

but I have done it by using the system API ,the function of the user32.dll

[DllImport("user32.dll")]
         public static extern bool RemoveMenu(IntPtr hMenu, Int32 wPosition, Int32 wFlags);


But using this function the relative functionality is also disabled.
I want to remove the system menu but the functionality should remain.
Posted

1 solution

I think the solutions using P/Invoke are ugly, but they should work:
http://blogs.msdn.com/b/wpfsdk/archive/2007/08/02/a-wpf-window-without-an-window-icon-the-thing-you-click-to-get-the-system-menu.aspx[^],
http://winsharp93.wordpress.com/2009/07/21/wpf-hide-the-window-buttons-minimize-restore-and-close-and-the-icon-of-a-window/[^].

I would probably prefer a .NET-only work-around.

You can use different windows style by assigning different value to the property System.Windows.Window.WindowStyle. You can also do it in XAML, in the top-level tag <Window>. Use the value of System.Windows.WindowStyle.ToolWindow. See:
http://msdn.microsoft.com/en-us/library/system.windows.window.windowstyle.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.windowstyle.aspx[^].

Alternatively, you can use System.Windows.WindowStyle.None, but in this case you won't have any non-client areas at all, not a title bar and buttons, nothing. This style is usually used to develop windows with non-rectangular shapes and other cases of highly customized appearance. In certain applications, the missing control elements of non-client area (such as close, minimize/restore buttons, system menu, etc.) are simply simulated in the client area using WPF controls, custom or not.

Pay attention for this second option; it is not so cumbersome as it might seem. This is just the maximum level of customization of appearance possible; such design totally goes away from dependency on Windows and presents pure "WPF-only" UI. For certain (maybe rather exotic) types of UI, this is the very best.

—SA
 
Share this answer
 
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900