protected override void OnHandleDestroyed(EventArgs e) { m_image?.Dispose(); GlImage?.Dispose(); GlWindow?.Dispose(); base.OnHandleDestroyed(e); }
protected override void OnSizeChanged(EventArgs e) { if (GlImage != null) { var dw = (Width - m_previousControlWidth) * Density; var dh = (Height - m_previousControlHeight) * Density; m_currentImageView.X -= dw / 2f; m_currentImageView.Width += dw; m_currentImageView.Y -= dh / 2f; m_currentImageView.Height += dh; } GlWindow.Begin(); GlWindow.ResizeWindow(Width, Height); Gl.MatrixMode(Gl.GL_PROJECTION); Gl.LoadIdentity(); Gl.Ortho2D(0, Width, Height, 0); GlWindow.End(); m_previousControlWidth = Width; m_previousControlHeight = Height; FixImageView(); base.OnSizeChanged(e); }
public ImageBoxWindow() { InitializeComponent(); GlWindow = new GlWindow(Handle); GlWindow.Begin(); Gl.ClearColor(Color.WhiteSmoke); GlWindow.End(); }
internal ImageBoxMiniMap(ImageBoxWindow imageBoxWindow) { InitializeComponent(); m_glWindow = new GlWindow(Handle); m_glWindow.Begin(); Gl.ClearColor(Color.WhiteSmoke); m_glWindow.End(); m_imageBoxWindow = imageBoxWindow; Win32.wglShareLists(m_imageBoxWindow.GlWindow.Hglrc, m_glWindow.Hglrc); }
protected override void OnPaint(PaintEventArgs e) { if (GlImage == null) { return; } if (Math.Abs(m_currentImageView.Width) < Eps) { CreateImageView(); } GlWindow.Begin(); Gl.Clear(Gl.GL_COLOR_BUFFER_BIT | Gl.GL_DEPTH_BUFFER_BIT); GlWindow.DrawImage(GlImage, ControlView, m_currentImageView); GlWindow.End(); GlWindow.SwapBuffers(); base.OnPaint(e); }