The code below is a small sample which copies an Enhanced Metafile data of 4 Line elements to the clipboard.
This works fine if pasted to MS Word, but if pasted to MS WordPad, a Line element which has over 16-bit coordinates disappars.
I tried this with the newest WordPad included in Windows 7, so I believe it does support GDI32. But the result indicates that it cannot replay over-16bit drawings.
Is there any way to successfully let WordPad draw this data (without doing clipping calculations manually)?
Thanks.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; void CMetafileTestDlg::OnBnClickedButton1()
{
HDC hdc = ::GetDC(GetSafeHwnd());
HDC hdcMf = CreateEnhMetaFile(hdc, NULL, NULL, L<span style="color:#A31515; "");
DeleteDC(hdc);
<span style="color:Blue; using <span style="color:Blue; namespace Gdiplus;
Graphics g(hdcMf);
g.SetClip(Rect(0,0,1000,1000));
Pen blackPen(Color(255, 0, 0, 0), 1);
Pen bluePen(Color(255, 0, 0, 255), 1);
Pen redPen(Color(255, 255, 0, 0), 1);
g.DrawLine(&blackPen, 0, 0, 0, 1000);
g.DrawLine(&blackPen, 0, 0, 1000, 0);
g.DrawLine(&bluePen, 0, 1000, 1000, 0);
INT d = 32768;
g.DrawLine(&redPen, 0, 0, d, d);
HENHMETAFILE hMf = CloseEnhMetaFile(hdcMf);
::OpenClipboard(GetSafeHwnd());
EmptyClipboard();
SetClipboardData(CF_ENHMETAFILE, hMf);
CloseClipboard();
}
[/code]
View the full article
This works fine if pasted to MS Word, but if pasted to MS WordPad, a Line element which has over 16-bit coordinates disappars.
I tried this with the newest WordPad included in Windows 7, so I believe it does support GDI32. But the result indicates that it cannot replay over-16bit drawings.
Is there any way to successfully let WordPad draw this data (without doing clipping calculations manually)?
Thanks.
<div style="color:Black;background-color:White; <pre>
<span style="color:Blue; void CMetafileTestDlg::OnBnClickedButton1()
{
HDC hdc = ::GetDC(GetSafeHwnd());
HDC hdcMf = CreateEnhMetaFile(hdc, NULL, NULL, L<span style="color:#A31515; "");
DeleteDC(hdc);
<span style="color:Blue; using <span style="color:Blue; namespace Gdiplus;
Graphics g(hdcMf);
g.SetClip(Rect(0,0,1000,1000));
Pen blackPen(Color(255, 0, 0, 0), 1);
Pen bluePen(Color(255, 0, 0, 255), 1);
Pen redPen(Color(255, 255, 0, 0), 1);
g.DrawLine(&blackPen, 0, 0, 0, 1000);
g.DrawLine(&blackPen, 0, 0, 1000, 0);
g.DrawLine(&bluePen, 0, 1000, 1000, 0);
INT d = 32768;
g.DrawLine(&redPen, 0, 0, d, d);
HENHMETAFILE hMf = CloseEnhMetaFile(hdcMf);
::OpenClipboard(GetSafeHwnd());
EmptyClipboard();
SetClipboardData(CF_ENHMETAFILE, hMf);
CloseClipboard();
}
[/code]
View the full article