其实比较简单,就是把一个不定长字符串(包含某些信息)写入EMF文件的description字段(其中EMF structure中的Description String应该可以存这些信息)。当然前提是能够读取这一字段。
问题是用C#肯定有比较现成的做法。哪位做过或知道怎么处理?
网上搜索的尽是使用GDI+在form上绘图的方式。我想要的是对EMF文件、流的操作的方式..
谢谢

解决方案 »

  1.   

    既然EMF文件的格式你知道,那你就可以用FileStream来定位写入。
      

  2.   

    定位并写入,可能有问题。比如破坏了某一个结构,我对这个结构还不熟悉。。我总感觉C#应该封装一个对象来提供操作,就像对MP3格式的album字段等修改一样简单。。
      

  3.   

    也许真可以试试。修改下面2个字段就可以nDescription (4 bytes): The number of Unicode characters in the optional description string that follows. Description (variable): An optional, null-terminated Unicode string that describes this group of records.
      

  4.   

    这是C++的一个封装。。C#有没有??
    Method Description 
    Metafile::ConvertToEmfPlus The ConvertToEmfPlus method converts this Metafile object to the EMF+ format. 
    Metafile::ConvertToEmfPlus The ConvertToEmfPlus method converts this Metafile object to the EMF+ format. 
    Metafile::ConvertToEmfPlus The ConvertToEmfPlus method converts this Metafile object to the EMF+ format. 
    Metafile::EmfToWmfBits Converts an enhanced-format metafile to a Windows Metafile Format (WMF) metafile and stores the converted records in a specified buffer.  
    Metafile::GetDownLevelRasterizationLimit Gets the rasterization limit currently set for this metafile. The rasterization limit is the resolution used for certain brush bitmaps that are stored in the metafile. For a detailed explanation of the rasterization limit, see SetDownLevelRasterizationLimit. 
    Metafile::GetHENHMETAFILE The GetHENHMETAFILE method gets a Windows handle to an Enhanced Metafile (EMF) file. 
    Metafile::GetMetafileHeader(WCHAR*,MetafileHeader*) The GetMetafileHeader method gets the header. 
    Metafile::GetMetafileHeader(HENHMETAFILE*,MetafileHeader*) The GetMetafileHeader method gets the header. 
    Metafile::GetMetafileHeader(HMETAFILE,WmfPlaceableFileHeader*,MetafileHeader*) The GetMetafileHeader method gets the metafile header of this metafile. 
    Metafile::GetMetafileHeader(MetafileHeader*) The GetMetafileHeader method gets the header. 
    Metafile::GetMetafileHeader(IStream*,MetafileHeader*) The GetMetafileHeader method gets the header. 
    Metafile::PlayRecord The PlayRecord method plays a metafile record. 
    Metafile::SetDownLevelRasterizationLimit Sets the resolution for certain brush bitmaps that are stored in this metafile.