/// <summary> /// Get the bitmap associated with a DC in the specified area /// </summary> /// <param name="HDC">(IntPtr) The HDC associated with the Bitmap</param> /// <param name="areaToCopy">(RECT) The area to copy</param> /// <returns>Returns the associated BMP</returns> IImageAdapterUnmanaged IVScanUnmanaged.ScreenSnapshotDcRc(IntPtr HDC, RECT areaToCopy) { using (Bitmap bmp = ImageUtility.CaptureBitmapFromDC(HDC, new Rectangle(areaToCopy.Left, areaToCopy.Top, areaToCopy.Right - areaToCopy.Left, areaToCopy.Bottom - areaToCopy.Top))) { OriginalData.Image = new ImageAdapter(bmp); } return((IImageAdapterUnmanaged)OriginalData.Image); }
/// <summary> /// Retrieve the Bitmap associated with a DC /// </summary> /// <param name="HDC">The HDC to query</param> /// <param name="x">x of the area to grab from the HDC</param> /// <param name="y">y of the area to grab from the HDC</param> /// <param name="width">width of the area to grab from the HDC</param> /// <param name="height">height of the area to grab from the HDC</param> /// <returns>Returns the associated BMP</returns> IImageAdapterUnmanaged IVScanUnmanaged.ScreenSnapshotDc(IntPtr HDC, int x, int y, int width, int height) { using (Bitmap bmp = ImageUtility.CaptureBitmapFromDC(HDC, new Rectangle(x, y, width, height))) { OriginalData.Image = new ImageAdapter(bmp); } return((IImageAdapterUnmanaged)OriginalData.Image); }