girvine1963
asked on
C++ .NET form save
Hi,
Does anyone know a quick way to capture and save a C++ .NET application's forms to disk in a graphics file?
Does anyone know a quick way to capture and save a C++ .NET application's forms to disk in a graphics file?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
public: void saveIssuerForm(void)
{
PictureBox *pbox = new PictureBox();
pbox->Location=Point(5,45)
pbox->Size=Drawing::Size(8
pbox->BorderStyle = BorderStyle::Fixed3D;
pbox->SizeMode = PictureBoxSizeMode::Stretc
this->Refresh();
HDC hDC;
HWND hWnd=(HWND)this->Handle.To
hDC = GetWindowDC(hWnd); //Now get it's DC handle
HDC hMemDC = CreateCompatibleDC(hDC);
RECT r;
GetWindowRect((HWND)this->
SIZE size;
size.cx = r.right-r.left;
size.cy = r.bottom-r.top;
HBITMAP hBitmap = CreateCompatibleBitmap(hDC
if (hBitmap)
{
HBITMAP hOld = (HBITMAP) SelectObject(hMemDC, hBitmap);
BitBlt(hMemDC, 0, 0, size.cx, size.cy, hDC, 0, 0, SRCCOPY);
SelectObject(hMemDC, hOld);
DeleteDC(hMemDC);
ReleaseDC(NULL, hDC);
pbox->Image = Image::FromHbitmap(hBitmap
pbox->Image->Save("C:\\Z.J
Drawing::Imaging::ImageFor
DeleteObject(hBitmap);
}
}