Esempio n. 1
0
        private void OnPictureBoxPaint(object sender, PaintEventArgs e)
        {
            Debug.WriteLine("OnPictureBoxPaint: Image="
                            + ((Image == null) ? "null" : Image.GetType().Name)
                            + " LinesImage="
                            + ((LinesImage == null) ? "null" : LinesImage.GetType().Name)
                            + " OverlayImage="
                            + ((OverlayImage == null) ? "null" : OverlayImage.GetType().Name));
            if (Image == null)
            {
                return;
            }
            Graphics g = e.Graphics;

            g.Clear(pictureBox.BackColor);
            g.DrawImage(Image, pictureBox.ClientRectangle, ViewRectangle,
                        GraphicsUnit.Pixel);
            if (LinesImage != null)
            {
                g.DrawImage(LinesImage, pictureBox.ClientRectangle, ViewRectangle,
                            GraphicsUnit.Pixel);
            }
            // Handle EDIT mode
            if (ActiveMode == Mode.EDIT && OverlayImage != null)
            {
                g.DrawImage(OverlayImage, pictureBox.ClientRectangle, ViewRectangle,
                            GraphicsUnit.Pixel);
            }
        }