/// <summary> /// Resizes the client area of the window using the specified parameters. /// </summary> /// <param name="width">Width of the client area</param> /// <param name="height">Height of the client area</param> public void Resize(int width, int height) { //If already in full screen, resize swap chain and notify any event handlers if (_isFullScreen) { _preferredWidth = width; _preferredHeight = height; _swapChain.Resize(width, height); if (ClientSizeChanged != null) { ClientSizeChanged(this, EventArgs.Empty); } //Otherwise resize the control, which will cause a WM_Size message } else { System.Windows.Forms.Control control = _control as System.Windows.Forms.Control; if (control != null) { control.ClientSize = new Size(width, height); _preferredWidth = width; _preferredHeight = height; if (!_isFullScreen) { System.Windows.Forms.Form f = control as System.Windows.Forms.Form; if (f != null) { System.Drawing.Rectangle rect = System.Windows.Forms.Screen.FromHandle(_control.Handle).Bounds; System.Drawing.Point center = new System.Drawing.Point(rect.Width / 2, rect.Height / 2); f.Location = new System.Drawing.Point(center.X - width / 2, center.Y - height / 2); } } } } }
private void WindowOnLoaded(object sender, RoutedEventArgs e) { ClientSize = new Size( (int)(Window.BorderHost.ActualWidth), (int)(Window.BorderHost.ActualHeight) ); OnPropertyChanged(nameof(ClientSize)); // change size event Window.BorderHost.SizeChanged += (sender2, args2) => { ClientSize = new Size( (int)(Window.BorderHost.ActualWidth), (int)(Window.BorderHost.ActualHeight) ); OnPropertyChanged(nameof(ClientSize)); }; var adapter = new SwapChainAdapter(Window.BorderHost); Window.BorderHost.Child = adapter; SwapChain = adapter.SwapChain; SwapChain.Resize(ClientSize.Width, ClientSize.Height); OnPropertyChanged(nameof(SwapChain)); }
public override void Resize(int width, int height) { Device.WaitIdle(); SwapChain.Resize(width, height); Framebuffer.Resize(); Camera.AspectRatio = (float)width / height; }
private void WindowOnLoaded(object sender, RoutedEventArgs e) { var adapter = new SwapChainAdapter(models.Window.Window.BorderHost); models.Window.Window.BorderHost.Child = adapter; swapChain = adapter.SwapChain; swapChain.Resize(models.Window.ClientSize.Width, models.Window.ClientSize.Height); }
protected override void OnResize(EventArgs e) { base.OnResize(e); if (SwapChain != null) { SwapChain.Resize(new VectorInt2(ClientSize.Width, ClientSize.Height)); Invalidate(); } }
public override void Resize(int width, int height) { Console.WriteLine($"Height: {height}"); Console.WriteLine($"Width: {width}"); Console.WriteLine("======="); Device.WaitIdle(); SwapChain.Resize(width, height); Framebuffer.Resize(); }
protected override void OnRenderSizeChanged(SizeChangedInfo sizeInfo) { base.OnRenderSizeChanged(sizeInfo); if (_swapChain != null) { StopRenderLoop(); _swapChain.Resize( Math.Max((int)sizeInfo.NewSize.Width, 1), Math.Max((int)sizeInfo.NewSize.Height, 1)); StartRenderLoop(); } }
public override void Resize(int width, int height) { Device.WaitIdle(); SwapChain.Resize(width, height); Framebuffer.Resize(); }
public static void Resize(uint width, uint height) { ReleaseBackbuffer(); SwapChain.Resize(width, height); InitBackbuffer(); }