Пример #1
0
 private void ResetImage()
 {
     lock (_imageToRenderLock)
     {
         if (IntPtr.Zero != _imageToRender)
         {
             GDI.DeleteObject(_imageToRender);
             _imageToRender = IntPtr.Zero;
         }
         _imageToRenderSize = emptySize;
     }
 }
Пример #2
0
        private void RenderImage(IImage image)
        {
            IntPtr imageToRender     = IntPtr.Zero;
            Size   imageToRenderSize = emptySize;

            if (null != image)
            {
                imageToRender     = image.Bitmap.GetHbitmap();
                imageToRenderSize = image.Size;
            }

            lock (_imageToRenderLock)
            {
                if (IntPtr.Zero != _imageToRender)
                {
                    GDI.DeleteObject(_imageToRender);
                }
                _imageToRender     = imageToRender;
                _imageToRenderSize = imageToRenderSize;
            }

            using (Graphics g = pictureBox.CreateGraphics())
                pictureBoxPaint(g, pictureBox.ClientRectangle);
        }