コード例 #1
0
 private void ImagePanel_Paint(object sender, PaintEventArgs e)
 {
     if (null != ImageBitmap)
     {
         ImagePanel.CreateGraphics().DrawImageUnscaled(ImageBitmap, 0, 0);
     }
     else
     {
         ImagePanel.CreateGraphics().Clear(Color.White);
     }
 }
コード例 #2
0
ファイル: DrawImageForm.cs プロジェクト: Arwedda/SOFT152
        private void DrawTheImage()
        {
            Rectangle pictureOnePosAndSize = new Rectangle(20, 30, 250, 200);

            using (Graphics panelGraphics = ImagePanel.CreateGraphics())
            {
                panelGraphics.Clear(Color.White);

                panelGraphics.DrawImage(pictureOne, pictureOnePosAndSize);
            }
        }  // end DrawTheImage()
コード例 #3
0
ファイル: DrawImageForm.cs プロジェクト: Arwedda/SOFT152
        }  // end DrawTheImage()

        private void ImagePanel_Paint(object sender, PaintEventArgs e)
        {
            // the Paint() method is called automatically, and it may be called
            // before a picture is loaded. So test for a null image and if null
            // then return from this method before the picture is used
            if (pictureOne == null)
            {
                // just a debug meesage to show if the picture is null when Paint() is called
                Console.WriteLine(" paint called pictureOne is null ");
                return;
            }

            Rectangle pictureOnePosAndSize = new Rectangle(20, 30, 250, 200);

            using (Graphics panelGraphics = ImagePanel.CreateGraphics())
            {
                panelGraphics.DrawImage(pictureOne, pictureOnePosAndSize);
            }
        }