Show / Hide Table of Contents

Method CaptureScreen.Image(+ 1 overload)


Overload

Creates image from a rectangle of screen pixels.

public static Bitmap Image(RECT r)
Parameters
r  (RECT)

Rectangle in screen.

Returns
Bitmap
Exceptions
ArgumentException

Empty rectangle.

AuException

Failed. Probably there is not enough memory for bitmap of this size (width*height*4 bytes).

Examples

var file = folders.Temp + "notepad.png";
wnd w = wnd.find("* Notepad");
w.GetRect(out var r, true);
using(var b = CaptureScreen.Image(r)) { b.Save(file); }
run.it(file);

Overload(top)

Creates image from a rectangle of window client area pixels.

public static Bitmap Image(wnd w, RECT? r = null, CIFlags flags = CIFlags.WindowDC)
Parameters
w  (wnd)

Window or control.

r  (RECT?)

Rectangle in w client area coordinates. If null, uses w.ClientRect.

flags  (CIFlags)
Returns
Bitmap
Exceptions
AuWndException

Invalid w.

ArgumentException

The rectangle is empty or does not intersect with the window's client area.

AuException

Failed. For example there is not enough memory for bitmap of this size (width*height*4 bytes).

Remarks

If flags contains WindowDC (default) or PrintWindow:

  • If the window is partially or completely transparent, captures its non-transparent view.
  • If the window is DPI-scaled, captures its non-scaled view. However r must contain scaled coordinates.