工控编程吧
标题:
MFC如何拷贝图像数据到剪切板
[打印本页]
作者:
qq263946146
时间:
2019-7-14 15:36
标题:
MFC如何拷贝图像数据到剪切板
下面代码拷贝通过元文件拷贝图像数据到任何应用程序,其可以放置在CView派生类的函数中。
CMetaFileDC * m_pMetaDC = new CMetaFileDC();
m_pMetaDC->CreateEnhanced(GetDC(),NULL,NULL,"whatever");
//draw meta file
//do what ever you want to do: bitmaps, lines, text...
//close meta file dc and prepare for clipboard;
HENHMETAFILE hMF = m_pMetaDC->CloseEnhanced();
//copy to clipboard
OpenClipboard();
EmptyClipboard();
::SetClipboardData(CF_ENHMETAFILE,hMF);
CloseClipboard();
//DeleteMetaFile(hMF);
delete m_pMetaDC;
欢迎光临 工控编程吧 (https://www.gkbc8.com/)
Powered by Discuz! X3.4