﻿<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/"><channel><title>C++博客-《深入解析ATL》第二版中文版上市-随笔分类-GDI+</title><link>http://www.cppblog.com/TechLab/category/212.html</link><description>有问题请到CSDN-&gt;VC/MFC讨论</description><language>zh-cn</language><lastBuildDate>Tue, 20 May 2008 07:24:32 GMT</lastBuildDate><pubDate>Tue, 20 May 2008 07:24:32 GMT</pubDate><ttl>60</ttl><item><title>用GDI+转BMP为WMF、EXIF、EMF格式</title><link>http://www.cppblog.com/TechLab/archive/2005/11/25/1302.html</link><dc:creator>TechLab</dc:creator><author>TechLab</author><pubDate>Fri, 25 Nov 2005 04:17:00 GMT</pubDate><guid>http://www.cppblog.com/TechLab/archive/2005/11/25/1302.html</guid><wfw:comment>http://www.cppblog.com/TechLab/comments/1302.html</wfw:comment><comments>http://www.cppblog.com/TechLab/archive/2005/11/25/1302.html#Feedback</comments><slash:comments>10</slash:comments><wfw:commentRss>http://www.cppblog.com/TechLab/comments/commentRss/1302.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/TechLab/services/trackbacks/1302.html</trackback:ping><description><![CDATA[<P>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;从MSDN上可以看到用GDI+的Image::Save方法可以很容易的实现把图片保存为BMP、GIF、TIFF、PNG、JPEG格式。虽然GDI+的Metafile类给了我们读取EMF、WMF格式图片方便，但是这个类没有直接提供保存的方法来写EMF、EXIF、WMF文件。这里介绍另外一种巧妙的写方法。<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;先用GDI+的Bitmap类建立一个对象，所有的画图操作完成之后形成一个Bitmap位图。然后传入一个需要保存的EMF等文件的路径。用空的文件路径构造一个Metafile对象，再用Metafile对象构造一个Graphics画图对象，最后把源位图用DrawImage画出来即可。这里的目标画图DC实际上就是用EMF文件。<BR>Bitmap m_Bitmap;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //已经画好的位图对象，或者之间用位图文件构造<BR>USES_CONVERSION;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//提供A2W宏字符串转换<BR>sFileName = "c:\\test.emf";&nbsp;&nbsp;&nbsp;//目标的EMF文件路径<BR>Metafile metafile(A2W(sFileName),cdc-&gt;m_hDC, EmfTypeEmfPlusDual,NULL);<BR>Graphics graphics(&amp;metafile);<BR>graphics.DrawImage(&amp;bmp, 0, 0, bmp.GetWidth(), bmp.GetHeight());</P><img src ="http://www.cppblog.com/TechLab/aggbug/1302.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/TechLab/" target="_blank">TechLab</a> 2005-11-25 12:17 <a href="http://www.cppblog.com/TechLab/archive/2005/11/25/1302.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>GDI+显示GIF动画</title><link>http://www.cppblog.com/TechLab/archive/2005/10/26/863.html</link><dc:creator>TechLab</dc:creator><author>TechLab</author><pubDate>Wed, 26 Oct 2005 07:12:00 GMT</pubDate><guid>http://www.cppblog.com/TechLab/archive/2005/10/26/863.html</guid><wfw:comment>http://www.cppblog.com/TechLab/comments/863.html</wfw:comment><comments>http://www.cppblog.com/TechLab/archive/2005/10/26/863.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/TechLab/comments/commentRss/863.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/TechLab/services/trackbacks/863.html</trackback:ping><description><![CDATA[GIF动画文件含有多个图像数据帧，GDI没有直接提供对GIF文件的支持。在GDI+中，通过Image对象可以很容易的操作GIF文件。更多内容请访问：<A HREF="/TechLab/articles/862.html">GDI+显示GIF动画 </A><img src ="http://www.cppblog.com/TechLab/aggbug/863.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/TechLab/" target="_blank">TechLab</a> 2005-10-26 15:12 <a href="http://www.cppblog.com/TechLab/archive/2005/10/26/863.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>