public void MaxWindow(object sender, RoutedEventArgs e) { if (WinState == JvedioWindowState.Normal) { //最大化 WinState = JvedioWindowState.Maximized; WindowPoint = new Point(this.Left, this.Top); WindowSize = new Size(this.Width, this.Height); this.Width = SystemParameters.WorkArea.Width; this.Height = SystemParameters.WorkArea.Height; this.Top = SystemParameters.WorkArea.Top; this.Left = SystemParameters.WorkArea.Left; ControlTemplate baseWindowTemplate = (ControlTemplate)App.Current.Resources["BaseWindowControlTemplate"]; Path MaxButtonPath = (Path)baseWindowTemplate.FindName("MaxButtonPath", this); MaxButtonPath.Data = Geometry.Parse(PathData.MaxToNormalPath); } else { WinState = JvedioWindowState.Normal; this.Left = WindowPoint.X; this.Width = WindowSize.Width; this.Top = WindowPoint.Y; this.Height = WindowSize.Height; ControlTemplate baseWindowTemplate = (ControlTemplate)App.Current.Resources["BaseWindowControlTemplate"]; Path MaxButtonPath = (Path)baseWindowTemplate.FindName("MaxButtonPath", this); MaxButtonPath.Data = Geometry.Parse(PathData.MaxPath); } HideMargin(); SizedChangedCompleted?.Invoke(this, new EventArgs()); }
public void MaxWindow(object sender, RoutedEventArgs e) { if (WinState == JvedioWindowState.Normal) { //最大化 WinState = JvedioWindowState.Maximized; WindowPoint = new Point(this.Left, this.Top); WindowSize = new Size(this.Width, this.Height); this.Width = SystemParameters.WorkArea.Width; this.Height = SystemParameters.WorkArea.Height; this.Top = SystemParameters.WorkArea.Top; this.Left = SystemParameters.WorkArea.Left; } else { WinState = JvedioWindowState.Normal; this.Left = WindowPoint.X; this.Width = WindowSize.Width; this.Top = WindowPoint.Y; this.Height = WindowSize.Height; } HideMargin(); SizedChangedCompleted?.Invoke(this, new EventArgs()); }
private void ResizeWindow(ResizeDirection direction) { SendMessage(_hwndSource.Handle, 0x112, (IntPtr)(61440 + direction), IntPtr.Zero); SizedChangedCompleted?.Invoke(this, new EventArgs()); }