13,825
社区成员
发帖
与我相关
我的任务
分享
void __fastcall TForm1::Button1Click(TObject *Sender)
{
Graphics::TBitmap *bmp = new Graphics::TBitmap;
HDC hdc = ::GetWindowDC(Handle);
try
{
bmp->PixelFormat = pf24bit;
bmp->Width = Width;
bmp->Height = Height;
TRect rct(0, 0, Width, Height);
::BitBlt(bmp->Canvas->Handle, 0, 0, Width, Height, hdc, 0, 0, SRCCOPY);
bmp->SaveToFile("C:\\ccrun\\123.bmp");
}
__finally
{
delete bmp;
::ReleaseDC(Handle, hdc);
}
}
Graphics::TBitmap *bitmap=new Graphics::TBitmap;
HDC hdc=::GetDC(Form1->Handle);
bitmap->Width=Form1->Width;
bitmap->Height=Form1->Height;
BitBlt(bitmap->Canvas->Handle, 0, 0, bitmap->Width, bitmap->Height, hdc, 0, 0, SRCCOPY);
bitmap->SaveToFile("C:\\11.bmp");
delete bitmap;
bitmap=NULL;