Пример #1
0
 protected override void OnHandleDestroyed(EventArgs e)
 {
     m_image?.Dispose();
     GlImage?.Dispose();
     GlWindow?.Dispose();
     base.OnHandleDestroyed(e);
 }
Пример #2
0
        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);
        }
Пример #3
0
        public ImageBoxWindow()
        {
            InitializeComponent();

            GlWindow = new GlWindow(Handle);

            GlWindow.Begin();
            Gl.ClearColor(Color.WhiteSmoke);
            GlWindow.End();
        }
Пример #4
0
        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);
        }
Пример #5
0
        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);
        }