コード例 #1
0
 public void GetMeasures(CatchMeasures catchMeasures)
 {
     this.txtTop.Text    = (_catchedMeasures.Top = catchMeasures.Top).ToString();
     this.txtLeft.Text   = (_catchedMeasures.Left = catchMeasures.Left).ToString();
     this.txtHeight.Text = (_catchedMeasures.Height = catchMeasures.Height).ToString();
     this.txtWidth.Text  = (_catchedMeasures.Width = catchMeasures.Width).ToString();
 }
コード例 #2
0
        private void CaptureMyScreen(string fullName, CatchMeasures catchMeasures)
        {
            try
            {
                //Creating a new Bitmap objectx
                Bitmap captureBitmap = new Bitmap(catchMeasures.Width, catchMeasures.Height - 30, PixelFormat.Format32bppArgb);

                //Bitmap captureBitmap = new Bitmap(int width, int height, PixelFormat);
                //Creating a Rectangle object which will
                //capture our Current Screen
                Rectangle captureRectangle = Screen.AllScreens[0].Bounds;

                //Creating a New Graphics Object
                Graphics captureGraphics = Graphics.FromImage(captureBitmap);

                //Copying Image from The Screen
                //captureGraphics.CopyFromScreen(captureRectangle.Left, captureRectangle.Top, 0, 0, captureRectangle.Size);
                captureGraphics.CopyFromScreen(catchMeasures.Left, catchMeasures.Top + 30, 0, 0, captureRectangle.Size);

                //Saving the Image File (I am here Saving it in My E drive).
                captureBitmap.Save(fullName, ImageFormat.Jpeg);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }