在C++BUILDER中,如何将整个窗体保存成图片??

porscheii 2007-03-27 07:57:28
就是通过程序实现,拷屏的功能。
...全文
283 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
___NULL 2007-03-28
  • 打赏
  • 举报
回复
/// 还有一段

void __fastcall CaptureWndImage(TRect rect)
{
awBitmap->Width = rect.Right - rect.Left;
awBitmap->Height = rect.Bottom - rect.Top;
HDC ScreenDC= GetDC(0);
try
{
StretchBlt(awBitmap->Canvas->Handle, 0, 0,
awBitmap->Width, awBitmap->Height, ScreenDC,
rect.Left, rect.Top,
awBitmap->Width,
awBitmap->Height,
SRCCOPY);
}
__finally
{
ReleaseDC(0, ScreenDC);
}
}
//---------------------------------------------------------------------------
___NULL 2007-03-28
  • 打赏
  • 举报
回复
bitmap 获得当前窗体的画面

void __fastcall CopyActiveWindowClick(Graphics::TBitmap* bitmap)
{
TRect rect;
HWND WinHandle =GetTopWndHandle();
GetWindowRect(WinHandle,&rect);
CaptureWndImage(rect);

bitmap->Width=awBitmap->Width;
bitmap->Height=awBitmap->Height;
bitmap->Canvas->Draw(0,0,awBitmap);
}
Y___Y 2007-03-27
  • 打赏
  • 举报
回复
这个简单,用个api函数BitBlt就搞定了

604

社区成员

发帖
与我相关
我的任务
社区描述
C++ Builder VCL组件使用和开发
社区管理员
  • VCL组件使用和开发社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧