Hide Minimize and Maximize Buttons


/ Published in: C#
Save to your folder(s)



Copy this code and paste it in your HTML
  1. internal static class WindowExtensions
  2. {
  3. [DllImport("user32.dll")]
  4. internal extern static int SetWindowLong(IntPtr hwnd, int index, int value);
  5.  
  6. [DllImport("user32.dll")]
  7. internal extern static int GetWindowLong(IntPtr hwnd, int index);
  8.  
  9. internal static void HideMinimizeAndMaximizeButtons(this Window window)
  10. {
  11. const int GWL_STYLE = -16;
  12.  
  13. IntPtr hwnd = new System.Windows.Interop.WindowInteropHelper(window).Handle;
  14. long value = GetWindowLong(hwnd, GWL_STYLE);
  15.  
  16. SetWindowLong(hwnd, GWL_STYLE, (int)(value & -131073 & -65537));
  17.  
  18. }
  19. }
  20.  
  21. this.SourceInitialized += (x, y) =>
  22. {
  23. this.HideMinimizeAndMaximizeButtons();
  24. };

URL: http://stackoverflow.com/questions/339620/how-do-i-remove-minimize-and-maximize-from-a-resizable-window-in-wpf

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.