﻿<?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++博客-apple-随笔分类-API学习</title><link>http://www.cppblog.com/apple/category/10386.html</link><description>世上本无事，庸人自扰之！</description><language>zh-cn</language><lastBuildDate>Tue, 28 Apr 2009 19:12:39 GMT</lastBuildDate><pubDate>Tue, 28 Apr 2009 19:12:39 GMT</pubDate><ttl>60</ttl><item><title>绘图API 位图显示</title><link>http://www.cppblog.com/apple/archive/2009/04/28/81382.html</link><dc:creator>明王不动</dc:creator><author>明王不动</author><pubDate>Tue, 28 Apr 2009 15:39:00 GMT</pubDate><guid>http://www.cppblog.com/apple/archive/2009/04/28/81382.html</guid><wfw:comment>http://www.cppblog.com/apple/comments/81382.html</wfw:comment><comments>http://www.cppblog.com/apple/archive/2009/04/28/81382.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/apple/comments/commentRss/81382.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/apple/services/trackbacks/81382.html</trackback:ping><description><![CDATA[<p>置于ONDRAW函数里面（单文档）：<br><br>CBitmap bm,*pbm;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //定义位图对象<br>&nbsp;BITMAP bmMetric;&nbsp;&nbsp;&nbsp;&nbsp; //定义位图结构变量，保存位图的参数如宽，高<br>&nbsp;bm.LoadBitmap (IDB_BITMAP2);&nbsp;&nbsp;&nbsp; <br>&nbsp;bm.GetBitmap (&amp;bmMetric);&nbsp; //保存位图的参数到结构变量bmMetric</p>
<p>&nbsp;CDC memDC;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //定义设备环境类对象<br>&nbsp;memDC.CreateCompatibleDC (pDC);&nbsp;&nbsp; //创建内存设备环境<br>&nbsp;&nbsp;&nbsp; <br>&nbsp;pbm=memDC.SelectObject (&amp;bm);&nbsp;&nbsp;&nbsp;&nbsp; //将位图选入设备环境<br>&nbsp;//将内存设备环境的位图传输到设备环境<br>&nbsp;pDC-&gt;BitBlt (0,0,bmMetric.bmWidth ,bmMetric.bmHeight ,&amp;memDC,0,0,SRCCOPY);<br>&nbsp;memDC.SelectObject (pbm);&nbsp; //恢复原设备环境对象<br>&nbsp;&nbsp;&nbsp; bm.DeleteObject ();<br>&nbsp;&nbsp;&nbsp; memDC.DeleteDC();</p>
<img src ="http://www.cppblog.com/apple/aggbug/81382.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/apple/" target="_blank">明王不动</a> 2009-04-28 23:39 <a href="http://www.cppblog.com/apple/archive/2009/04/28/81382.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>绘图API 画刷</title><link>http://www.cppblog.com/apple/archive/2009/04/28/81326.html</link><dc:creator>明王不动</dc:creator><author>明王不动</author><pubDate>Tue, 28 Apr 2009 08:01:00 GMT</pubDate><guid>http://www.cppblog.com/apple/archive/2009/04/28/81326.html</guid><wfw:comment>http://www.cppblog.com/apple/comments/81326.html</wfw:comment><comments>http://www.cppblog.com/apple/archive/2009/04/28/81326.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/apple/comments/commentRss/81326.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/apple/services/trackbacks/81326.html</trackback:ping><description><![CDATA[<p>初始化画刷函数：<strong><br>BOOL</strong> <strong>CreateHatchBrush(</strong> <strong>int</strong> <em>nIndex</em><strong>,</strong> <strong>COLORREF</strong> <em>crColor</em> <strong>);</strong></p>
<p class=label><em>nIndex</em></p>
<p class=indent>Specifies the hatch style of the brush. It can be any one of the following values:
<ul type=disc>
    <li><strong>HS_BDIAGONAL</strong>&nbsp;&nbsp;&nbsp;Downward hatch (left to right) at 45 degrees&nbsp;&nbsp;&nbsp; //反斜线<br>
    <li><strong>HS_CROSS</strong>&nbsp;&nbsp;&nbsp;Horizontal and vertical crosshatch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;//正交叉网格&nbsp;&nbsp;&nbsp;&nbsp;<br>
    <li><strong>HS_DIAGCROSS</strong>&nbsp;&nbsp;&nbsp;Crosshatch at 45 degrees&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //斜交叉网格<br>
    <li><strong>HS_FDIAGONAL</strong>&nbsp;&nbsp;&nbsp;Upward hatch (left to right) at 45 degrees&nbsp;&nbsp; //正斜线<br>
    <li><strong>HS_HORIZONTAL</strong>&nbsp;&nbsp;&nbsp;Horizontal hatch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //水平线<br>
    <li><strong>HS_VERTICAL</strong>&nbsp;&nbsp;&nbsp;Vertical hatch&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; //垂直线&nbsp; </li>
</ul>
<p>创建位图画刷：<br></p>
<p><strong>BOOL</strong> <strong>CreatePatternBrush(</strong> <strong>CBitmap*</strong> <em>pBitmap</em> <strong>);</strong></p>
<p class=label><strong>Return Value</strong></p>
<p>Nonzero if successful; otherwise 0.</p>
<p class=label><strong>Parameters</strong></p>
<p class=dt><em>pBitmap</em></p>
<p class=indent>Identifies a bitmap.</p>
/*CBitmap bm;<br>&nbsp;bm.LoadBitmap (IDB_BITMAP1);<br>&nbsp;CBrush br;<br>&nbsp;br.CreatePatternBrush (&amp;bm);<br>*/
<img src ="http://www.cppblog.com/apple/aggbug/81326.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/apple/" target="_blank">明王不动</a> 2009-04-28 16:01 <a href="http://www.cppblog.com/apple/archive/2009/04/28/81326.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item><item><title>绘图API  画笔，画线</title><link>http://www.cppblog.com/apple/archive/2009/04/28/81317.html</link><dc:creator>明王不动</dc:creator><author>明王不动</author><pubDate>Tue, 28 Apr 2009 06:08:00 GMT</pubDate><guid>http://www.cppblog.com/apple/archive/2009/04/28/81317.html</guid><wfw:comment>http://www.cppblog.com/apple/comments/81317.html</wfw:comment><comments>http://www.cppblog.com/apple/archive/2009/04/28/81317.html#Feedback</comments><slash:comments>0</slash:comments><wfw:commentRss>http://www.cppblog.com/apple/comments/commentRss/81317.html</wfw:commentRss><trackback:ping>http://www.cppblog.com/apple/services/trackbacks/81317.html</trackback:ping><description><![CDATA[<p>创建画笔：<br><strong>BOOL</strong> <strong>CreatePen(</strong> <strong>int</strong> <em>nPenStyle</em><strong>,</strong> <strong>int</strong> <em>nWidth</em><strong>,</strong> <strong>const</strong> <strong>LOGBRUSH*</strong> <em>pLogBrush</em><strong>,</strong> <strong>int</strong> <em>nStyleCount</em> <strong>=</strong> <strong>0,</strong> <strong>const</strong> <strong>DWORD*</strong> <em>lpStyle</em> <strong>=</strong> <strong>NULL</strong> <strong>);<br>nPenStyle 有PS_SOLID,PS_DASH,PS_DOT,PS_DASHDOT,PS_DASHDOTDOT,PS_NULL</strong></p>
也就是实线，虚线，点虚线，点划线，双点划线，空笔（不可见），其值分别为0，1，2，3 ，4，5<br><strong>//&nbsp;mypen.CreatePen(0,0,RGB(0,0,255));</strong><br><br>画笔选入选出设备环境：<br>
<p><strong>CPen*</strong> <strong>SelectObject(</strong> <strong>CPen*</strong> <em>pPen</em> <strong>);&nbsp; <br>类似的有：<br></p>
<p><strong>CBrush*</strong> <strong>SelectObject(</strong> <strong>CBrush*</strong> <em>pBrush</em> <strong>);</strong></p>
<p><strong>virtual</strong> <strong>CFont*</strong> <strong>SelectObject(</strong> <strong>CFont*</strong> <em>pFont</em> <strong>);</strong></p>
<p><strong>CBitmap*</strong> <strong>SelectObject(</strong> <strong>CBitmap*</strong> <em>pBitmap</em> <strong>);</strong></p>
<p><strong>int</strong> <strong>SelectObject(</strong> <strong>CRgn*</strong> <em>pRgn</em> <strong>);<br></strong>画笔删除：<br></p>
<p><strong>BOOL</strong> <strong>DeleteObject(</strong> <strong>);&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;//mypen.DeleteObject();</strong></p>
<p class=label><strong>Return Value</strong></p>
<p>Nonzero if the GDI object was successfully deleted; otherwise 0.<br></p>
<p><br>画线函数：<br>MoveTo(int i,int j); //origin point<br>LineTo(int i,int j);&nbsp; //destination<br><br></strong></p>
<img src ="http://www.cppblog.com/apple/aggbug/81317.html" width = "1" height = "1" /><br><br><div align=right><a style="text-decoration:none;" href="http://www.cppblog.com/apple/" target="_blank">明王不动</a> 2009-04-28 14:08 <a href="http://www.cppblog.com/apple/archive/2009/04/28/81317.html#Feedback" target="_blank" style="text-decoration:none;">发表评论</a></div>]]></description></item></channel></rss>