Re: 问各位高手关于CNiGraph
时间:12-13
整理:3721RD
点击:
存成emf文件比较简单,
CFileDialog dlg(FALSE, "emf", "*.emf", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, ".emf");
if(dlg.DoModal() == IDOK)
{
HDC hMetaFileDC;
CDC cdc;
CRect rcGraph;
CMetaFileDC mf;
CPictureHolder ph;
VERIFY(mf.CreateEnhanced(NULL, dlg.GetPathName(), NULL, NULL));
hMetaFileDC = mf.m_hDC;
cdc.Attach(hMetaFileDC);
// get the rectangle of the controls in screen coordinates
m_Graph.GetWindowRect(&rcGraph);
// convert the coordinates into the coordinates of the dialog window
ScreenToClient(&rcGraph);
// Control Image returns a metafile of the control
ph.SetPictureDispatch((LPPICTUREDISP)m_Graph.ControlImage().GetDispatch(FALSE));
ph.Render(&cdc, rcGraph, rcGraph);
HENHMETAFILE handle = mf.CloseEnhanced();
DeleteEnhMetaFile(handle);
}
CFileDialog dlg(FALSE, "emf", "*.emf", OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, ".emf");
if(dlg.DoModal() == IDOK)
{
HDC hMetaFileDC;
CDC cdc;
CRect rcGraph;
CMetaFileDC mf;
CPictureHolder ph;
VERIFY(mf.CreateEnhanced(NULL, dlg.GetPathName(), NULL, NULL));
hMetaFileDC = mf.m_hDC;
cdc.Attach(hMetaFileDC);
// get the rectangle of the controls in screen coordinates
m_Graph.GetWindowRect(&rcGraph);
// convert the coordinates into the coordinates of the dialog window
ScreenToClient(&rcGraph);
// Control Image returns a metafile of the control
ph.SetPictureDispatch((LPPICTUREDISP)m_Graph.ControlImage().GetDispatch(FALSE));
ph.Render(&cdc, rcGraph, rcGraph);
HENHMETAFILE handle = mf.CloseEnhanced();
DeleteEnhMetaFile(handle);
}
Tools->Measurement Studio Reference->Visual C++ Help->Tutorials->
Distributing and ...