我已经完成了使用GDI+ 保存图元文件emf,但是不知道怎么去读取显示已生成的emf格式图片,请各位高手速速帮忙,最好是请使用vc++代码演示一下,高分回馈,谢了

解决方案 »

  1.   

    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();
      

  2.   

    下列范例显示先前储存为档案的图元文件。图元文件的左上角显示在 (100, 100)。Graphics myGraphics(hdc);
    Image myImage(L"MyDiskFile.emf");
    myGraphics.DrawImage(&myImage, 100, 100);
      

  3.   

    Presenting EMFexplorer, a GDI+ experimenthttp://www.codeproject.com/KB/GDI-plus/emfexplorer.aspx
      

  4.   


    //在一个CStatic中显示
    HWND hWnd = GetDlgItem(IDC_STATIC_PIC)->GetSafeHwnd();
    Graphics myGraphics(hWnd);
    Metafile myMetafile(L"C:\\bar.emf");
    myGraphics.DrawImage(&myMetafile, 0, 0);