コード例 #1
0
 public static void CheckIfWindowStyleIsFullscreen(WindowStyle w)
 {
     if (w.Equals(WindowStyle.Fullscreen))
         MessageBox.Show("Your windowstyle seems to be \"Fullscreen\".\n" +
                         "If you want to use this tool, change the\n" +
                         "Windowstyle to \"Windowed\" or \"Windowed Fullscreen\"\n" +
                         "to have the best experience!", "Windowstyle");
 }
コード例 #2
0
        public ThemedWindow()
        {
            CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, OnSystemCommandCloseWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand, OnSystemCommandMaximizeWindow, OnSystemCommandCanResizeWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand, OnSystemCommandMinimizeWindow, OnSystemCommandCanMinimizeWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand, OnSystemCommandRestoreWindow));
            CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, OnSystemCommandShowSystemMenu));

            PreviewKeyDown += (s, e) =>
            {
                Key key = (e.Key == Key.System ? e.SystemKey : e.Key);  // Handle true key
                if (key.Equals(Key.F11) || (e.KeyboardDevice.Modifiers.Equals(ModifierKeys.Alt) && key.Equals(Key.Enter)))
                {
                    if (!WindowStyle.Equals(WindowStyle.SingleBorderWindow))
                    {
                        RestoreFromFullScreenMode();
                    }
                    else
                    {
                        FullScreenMode();
                    }
                }
            };
        }