PrintWindow截图

PC_9527 2011-01-25 01:38:32
一个子类化的Picture控件,用于显示不断变更的图像,父窗口是对话框,由于图像比较大,有一 部分图像会被遮挡,可以用PrintWindow把完整图像截出来吗?
...全文
593 12 打赏 收藏 转发到动态 举报
写回复
用AI写文章
12 条回复
切换为时间正序
请发表友善的回复…
发表回复
Dxy1239310216 2013-08-13
  • 打赏
  • 举报
回复
可不可以实现后台找色
yidaonaxia 2011-09-05
  • 打赏
  • 举报
回复
高,真在找这方面的资料
hqdvista 2011-02-08
  • 打赏
  • 举报
回复
其实不明白楼主什么意思。。。
schlafenhamster 2011-01-26
  • 打赏
  • 举报
回复
参考:

//
void CScrollBitmapDlg::CopyPictures(HWND hWnd,CPoint point)
{// TODO: Add your message handler code here
UINT ID=::GetDlgCtrlID(hWnd);
// afxDump << ID << " ID\n";
// size
CRect rc;
if(hWnd==0)
{
ID=0;
GetWindowRect(&rc);// the dialog
}
else
{
::GetWindowRect(hWnd,&rc);
}
// create dc
CClientDC dc(this);
CDC dcMem;
dcMem.CreateCompatibleDC(&dc);
// create empty bmp
HBITMAP bmp=CreateCompatibleBitmap(dc /* not dcMem */, rc.Width(),rc.Height());
dcMem.SelectObject(bmp);
//
CString prompt;
switch (ID)
{
case IDOK:// "Exit"
m_Ok.SendMessage(WM_PAINT,(WPARAM)dcMem.m_hDC,0);
prompt="\"Exit\" button has been copied to clipbroad!";
break;
case IDC_SCROLLBAR1:// "H bar"
m_hBar.SendMessage(WM_PAINT,(WPARAM)dcMem.m_hDC,0);
prompt="\"Horizontal\" scrollbar has been copied to clipbroad!";
break;
case IDC_SCROLLBAR2:// "V bar"
m_vBar.SendMessage(WM_PAINT,(WPARAM)dcMem.m_hDC,0);
prompt="\"Vertical\" scrollbar has been copied to clipbroad!";
break;
case IDC_SHOW:// "Open"
m_Open.SendMessage(WM_PAINT,(WPARAM)dcMem.m_hDC,0);
prompt="\"Open\" button has been copied to clipbroad!";
break;
case IDC_PICTURE:// m_Pic
OnMyPaint((WPARAM)dcMem.m_hDC,0);
prompt="\"CStatic Picture\" has been copied to clipbroad!";
break;
case 0:// the dialog
this->SendMessage(WM_PRINT,(WPARAM)dcMem.m_hDC,
(LPARAM)(PRF_NONCLIENT | PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_OWNED));
prompt="\"The whole dialog\" has been copied to clipbroad!";
break;
}
// move bmp to clipboard
CBitmap *pbmp=dcMem.GetCurrentBitmap();
OpenClipboard();
EmptyClipboard();
SetClipboardData(CF_BITMAP,pbmp->GetSafeHandle());
CloseClipboard();
//
DeleteObject(bmp);
//
AfxMessageBox(prompt);
}

重点:
m_Ok.SendMessage(WM_PAINT,(WPARAM)dcMem.m_hDC,0);
__lhy 2011-01-26
  • 打赏
  • 举报
回复
截图(包括被遮住的部分)
HBITMAP hbmp;
SendMessage(hwnd,WM_PAINT,(WPARAM)hbmp,0);
schlafenhamster 2011-01-26
  • 打赏
  • 举报
回复
看看会有什么结果
PC_9527 2011-01-26
  • 打赏
  • 举报
回复
[Quote=引用 3 楼 xiuxianshen 的回复:]
楼主要截哪部分的图,我都看不懂
[/Quote]

子类化的Picture控件
chen_freecom 2011-01-25
  • 打赏
  • 举报
回复
可以啊 PrintWindow 可以获取遮挡的部分.......
xiuxianshen 2011-01-25
  • 打赏
  • 举报
回复
楼主要截哪部分的图,我都看不懂
datiwei 2011-01-25
  • 打赏
  • 举报
回复
PrintWindow!!??
fishion 2011-01-25
  • 打赏
  • 举报
回复
直接用StretchBlt绘制

19,468

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 图形处理/算法
社区管理员
  • 图形处理/算法社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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