急!!! 如何使用GDI+ 读取显示emf格式文件? 我已经完成了使用GDI+ 保存图元文件emf,但是不知道怎么去读取显示已生成的emf格式图片,请各位高手速速帮忙,最好是请使用vc++代码演示一下,高分回馈,谢了 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 Graphics metagraph=this.CreateGraphics(); Metafile metaFileOld = new Metafile("你的原始文件名.emf"); //新建一个图元文件 IntPtr hdc =metagraph.GetHdc(); Metafile metaFile1 = new Metafile("你的文件名.emf", hdc); //使用Metafile对象的地址做为绘图平面 Graphics graphics = Graphics.FromImage(metaFile1); graphics.DrawImage(metaFileOld,new Point(0,0)); //以下是你自己的增加操作 graphics.Draw....; graphics.Fill....; //例如:文本输出 SolidBrush solidBrush = new SolidBrush(Color.Black); FontFamily fontFamily = new FontFamily("隶书"); Font font = new Font(fontFamily, 27, FontStyle.Regular, GraphicsUnit.Pixel); graphics.DrawString("图元文件示例", font, solidBrush, new PointF(20.0f, 80.0f)); //释放所有资源。 graphics.Dispose(); metaFile1.Dispose(); metaFileOld.Dispose(); metagraph.ReleaseHdc(hdc); metagraph.Dispose(); //将上面的绘图信息进行回放 Graphics playbackGraphics = this.CreateGraphics(); playbackGraphics.Clear(Color.White); //打开并显示图元文件 Metafile metaFile2 = new Metafile("你的文件名.emf"); playbackGraphics.DrawImage(metaFile2,new Point(0,0)); //关闭已经打开的图元文件 metaFile2.Dispose(); 下列范例显示先前储存为档案的图元文件。图元文件的左上角显示在 (100, 100)。Graphics myGraphics(hdc);Image myImage(L"MyDiskFile.emf");myGraphics.DrawImage(&myImage, 100, 100); Presenting EMFexplorer, a GDI+ experimenthttp://www.codeproject.com/KB/GDI-plus/emfexplorer.aspx //在一个CStatic中显示HWND hWnd = GetDlgItem(IDC_STATIC_PIC)->GetSafeHwnd();Graphics myGraphics(hWnd);Metafile myMetafile(L"C:\\bar.emf");myGraphics.DrawImage(&myMetafile, 0, 0); 高分求救(与OFFICE和LOTUS NOTES7.1冲突?) winmain()的疑问 内核同步问题 在线求助:单文档多视图,如何对两个视图拆分 問題請教 为什么总让我左右为难??99我 映射模式的困惑。。。。 大伙给出出注意!! 关于ActiveX控件的数字签名和认证问题 "一句话晒正版,赢精美礼品 高分求救!!! 如何使用GDI+ 读取显示emf格式文件? 原访问方式为ODBC,现要求将其改为ADO方式,该怎么做?
Metafile metaFileOld = new Metafile("你的原始文件名.emf");
//新建一个图元文件
IntPtr hdc =metagraph.GetHdc();
Metafile metaFile1 = new Metafile("你的文件名.emf", hdc);
//使用Metafile对象的地址做为绘图平面
Graphics graphics = Graphics.FromImage(metaFile1);
graphics.DrawImage(metaFileOld,new Point(0,0));
//以下是你自己的增加操作
graphics.Draw....;
graphics.Fill....;
//例如:文本输出
SolidBrush solidBrush = new SolidBrush(Color.Black);
FontFamily fontFamily = new FontFamily("隶书");
Font font = new Font(fontFamily, 27,
FontStyle.Regular, GraphicsUnit.Pixel);
graphics.DrawString("图元文件示例", font, solidBrush,
new PointF(20.0f, 80.0f));
//释放所有资源。
graphics.Dispose();
metaFile1.Dispose();
metaFileOld.Dispose();
metagraph.ReleaseHdc(hdc);
metagraph.Dispose();
//将上面的绘图信息进行回放
Graphics playbackGraphics = this.CreateGraphics();
playbackGraphics.Clear(Color.White);
//打开并显示图元文件
Metafile metaFile2 = new Metafile("你的文件名.emf");
playbackGraphics.DrawImage(metaFile2,new Point(0,0));
//关闭已经打开的图元文件
metaFile2.Dispose();
Image myImage(L"MyDiskFile.emf");
myGraphics.DrawImage(&myImage, 100, 100);
//在一个CStatic中显示
HWND hWnd = GetDlgItem(IDC_STATIC_PIC)->GetSafeHwnd();
Graphics myGraphics(hWnd);
Metafile myMetafile(L"C:\\bar.emf");
myGraphics.DrawImage(&myMetafile, 0, 0);