Skip to main content


Save a bitmap image of a screen area.

void SaveBitmap(string pathName, Rectangle rectangle);

void SaveBitmap(string pathName, int x, int y, int width, int height);


pathName: The name or pathname of the bitmap image file to be saved

rectangle: The System.Drawing.Rectangle object that defines the bitmap area

x: The top left hand corner x coordinate of the area to be captured

y: The top left hand corner y coordinate of the area to be captured

width: The width of the area to be captured

height: The hight of the area to be captured

Return Value



If pathName does not have a ".bmp" suffix, then this will be added.

If and absolute


// Capture a region of the screen
Control MyDialog = FindTopWindow("my window title");
Rectangle rect = new Rectangle(MyDialog.X + 20, MyDialog.Y + 50, 20, 50);
SaveBitmap("MyImage", rect);

// Capture the desktop
Control progman = FindTopWindow("Program Manager", "Progman");
Control desktop = progman.FindControl("FolderView");
// RunPath and VUName are VU properties for the run logs path and group name
string filePath = String.Format("{0}\\{1}_{2}_{3}.bmp", RunPath, VUName, Index, Iteration);
SaveBitmap(filePath, desktop.Rectangle);