/// <summary> /// Registered event for the window when the mouse is held. /// Allows us to move the window around by dragging the background. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void Window_MouseDown(object sender, MouseButtonEventArgs e) { if (_overlayHelper.WindowFollowMode != WindowFollowMode.Overlay) { // Reusing Reloaded-GUI's (Launcher Theming/Utility Library) MoveWindow.MoveTheWindow(new WindowInteropHelper(this).Handle); } }
/// <summary> /// Show dialog to modify an Instruction. /// </summary> /// <param name="ins">The Instruction being modified.</param> /// <param name="owner">The owner Window.</param> /// <returns>The modified Instruction.</returns> public static Instruction ShowDialog(Instruction ins, Window owner) { BaseParamWindow dlg = null; switch (ins.opcode) { case Instruction.MOVE: dlg = new MoveWindow(); break; case Instruction.ROTATE: dlg = new RotateWindow(); break; case Instruction.LED: dlg = new LedWindow(); break; case Instruction.SONG: dlg = new SongWindow(); break; case Instruction.DEMO: dlg = new DemoWindow(); break; case Instruction.DRIVE: dlg = new DriveWindow(); break; case Instruction.DELAY: dlg = new DelayWindow(); break; } if (dlg != null) { dlg.Owner = owner; dlg.Ins = ins; dlg.ShowDialog(); // Alway read from the Window. There is no guarantee that the original Instruction is modified. Instruction result = dlg.Ins; Debug.WriteLine(result); return(dlg.Ins); } else { MessageBox.Show(ins.opcode + " no implemented."); } return(null); }
/// <summary> /// Themes an individual windows forms control. /// </summary> /// <param name="control"></param> private static void ThemeControl(Control control) { // Apply the appropriate fonts to the control. ApplyFonts(control); // Theme the Category, Main and Title Buttons if (IsMainItem(control)) { ThemeButton(control, Theme.ThemeProperties.MainColours, Theme.ThemeProperties.MainEnterAnimation, Theme.ThemeProperties.MainLeaveAnimation, true); } else if (IsCategoryItem(control)) { ThemeButton(control, Theme.ThemeProperties.CategoryColours, Theme.ThemeProperties.CategoryEnterAnimation, Theme.ThemeProperties.CategoryLeaveAnimation, false); } else if (IsBox(control)) { ThemeButton(control, Theme.ThemeProperties.BoxColours, Theme.ThemeProperties.BoxEnterAnimation, Theme.ThemeProperties.BoxLeaveAnimation, true); } else if (IsBorderless(control)) { ThemeButton(control, Theme.ThemeProperties.BorderlessColours, Theme.ThemeProperties.BorderlessEnterAnimation, Theme.ThemeProperties.BorderlessLeaveAnimation, false); } else if (IsTitleItem(control)) { ThemeButton(control, Theme.ThemeProperties.TitleColours, Theme.ThemeProperties.TitleEnterAnimation, Theme.ThemeProperties.TitleLeaveAnimation, false); // Automatic Dragging! control.MouseDown += (sender, args) => MoveWindow.MoveTheWindow(control.FindForm().Handle); } else { ThemeButton(control, Theme.ThemeProperties.MainColours, Theme.ThemeProperties.MainEnterAnimation, Theme.ThemeProperties.MainLeaveAnimation, true); } if (!control.Name.StartsWith("box_")) { foreach (Control controlEmbedded in control.Controls) { ThemeControl(controlEmbedded); } } }
private void OpenPresenterWindow() { presenterWindow = new PresenterWindow(); presenterWindow.DataContext = this; presenterWindow.Closing += (s, e) => { var result = MessageBox.Show("Na pewno zamknąć okno i wyłączyć aplikację?", "Uwaga", MessageBoxButton.YesNo); if (result == MessageBoxResult.Yes) { Environment.Exit(0); } else { e.Cancel = true; } }; presenterWindow.Show(); MoveWindow.MaximizeToSecondaryMonitor(presenterWindow); }
private void panel1_MouseDown(object sender, MouseEventArgs e) { MoveWindow.ReleaseCapture(); MoveWindow.SendMessage(Handle, 0x112, 0xf012, 0); }
private void OnMoveWindow(Point newPosition) { MoveWindow?.Invoke(newPosition); }
private void FEditarRef_MouseMove(object sender, MouseEventArgs e) { MoveWindow.ReleaseCapture(); MoveWindow.SendMessage(this.Handle, 0x112, 0xf012, 0); }