亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? ch12.htm

?? 一天之內學會VC#. 主要介紹VC#的各種應用和示例
?? HTM
?? 第 1 頁 / 共 4 頁
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"><HTML><HEAD>		<TITLE>Teach Yourself Visual C++&#174; 5 in 24 Hours -- Hour 12 -- Using Pens and Brushes</TITLE></HEAD><BODY TEXT="#000000" BGCOLOR="#FFFFFF"><CENTER><H1><IMG SRC="../button/sams.gif" WIDTH="171" HEIGHT="66" ALIGN="BOTTOM" BORDER="0"><BR><FONT COLOR="#000077">Teach Yourself Visual C++&#174; 5 in 24 Hours</FONT></H1></CENTER><CENTER><P><A HREF="../ch11/ch11.htm"><IMG SRC="../button/previous.gif" WIDTH="128" HEIGHT="28"ALIGN="BOTTOM" ALT="Previous chapter" BORDER="0"></A><A HREF="../ch13/ch13.htm"><IMGSRC="../button/next.gif" WIDTH="128" HEIGHT="28" ALIGN="BOTTOM" ALT="Next chapter"BORDER="0"></A><A HREF="../index.htm"><IMG SRC="../button/contents.gif" WIDTH="128"HEIGHT="28" ALIGN="BOTTOM" ALT="Contents" BORDER="0"></A> <HR></CENTER><CENTER><H1><FONT COLOR="#000077">- Hour 12 -<BR>Using Pens and Brushes</FONT></H1></CENTER><P>In this hour you will look at pens and brushes. Specifically, you will learn<UL>	<LI>How pens are used to draw lines and geometric shapes in Windows programs<BR>	<BR>		<LI>How brushes are used to fill areas with colors and patterns<BR>	<BR>		<LI>MFC class library support that simplifies the use of pens and brushes</UL><P>You also modify the DCTest sample program from Hour 11, &quot;Device Contexts,&quot;to draw a variety of figures using pens and brushes.<H2><FONT COLOR="#000077"><B>What Is a Pen?</B></FONT></H2><P><FONT COLOR="#000077"><B>New Term:</B></FONT><B> </B>A <I>pen</I> is a WindowsGDI object used to draw lines and figures.</P><P>Think of a Windows pen as being like an ink pen at your desk. A Windows pen objecthas three attributes:<UL>	<LI><I>Width:</I> Normally one pixel wide, although a pen can be as wide as you like<BR>	<BR>		<LI><I>Style:</I> Can be any of the pen styles discussed in this chapter<BR>	<BR>		<LI><I>Color:</I> Can be any Windows color packed into a <TT>COLORREF</TT> structure</UL><P>Programs written for Windows use two types of pens:<UL>	<LI><I>Cosmetic pens</I>, which are always drawn in device units, regardless of the	current mapping mode.<BR>	<BR>		<LI><I>Geometric pens</I>, which are drawn in logical units and are affected by the	current mapping mode. Geometric pens have more style and drawing options than cosmetic	pens.</UL><P>You use a cosmetic pen when you must always draw lines with a fixed size. Forexample, rulers and grid lines are often drawn using cosmetic pens. You use geometricpen lines to reflect the scaling provided by the current mapping mode.<BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Just a Minute:</B></FONT><B> </B>A pen is perfect	in situations in which you must draw a geometric shape or line. Although you can	use a bitmap for complicated images, you easily can draw squares, rectangles, circles,	and other basic shapes using GDI objects. <HR></BLOCKQUOTE><P>You can create and use pens with a variety of styles. Cosmetic pens are extremelyquick and are mapped directly into device units. This makes them useful for drawingthings like frames, borders, grid lines, and other screen objects that should notbe affected by the current device context-mapping mode. Geometric pens require moreCPU power but offer more styles. You can manipulate geometric pens using any of theavailable mapping modes.</P><P>Pens are also useful for drawing three-dimensional highlighting or other effects.It's not uncommon for pens and other GDI objects to be used to simulate controlsin Windows; before Windows 95 was released, early versions of property pages usedpens to draw simulated &quot;tabs.&quot;<H3><FONT COLOR="#000077"><B>MFC Support for Pens</B></FONT></H3><P>Like other GDI objects, you normally use a pen by creating an MFC object. Usethe <TT>CPen</TT> class to create and manage both cosmetic and geometric pens. Whencreating a pen, you must specify at least three things:<UL>	<LI>The pen's style	<LI>The pen's width	<LI>The pen's color</UL><BLOCKQUOTE>	<P><HR><B> </B><FONT COLOR="#000077"><B>Time Saver:</B></FONT><B> </B>The number of styles	available for geometric pens is much larger than for cosmetic pens. However, cosmetic	pens have much less overhead. You should use cosmetic pens whenever possible. The	next few sections discuss the various options available for cosmetic and geometric	pens. <HR></BLOCKQUOTE><H3><FONT COLOR="#000077"><B>Using Cosmetic Pens</B></FONT></H3><P>Cosmetic pens are not affected by the current mapping mode's scaling factor becausethey are always drawn in device units. Therefore, they are useful where a line mustoverlay another view that may be scaled. These basic styles are available for cosmeticpens:<UL>	<LI><TT>PS_SOLID</TT>: Creates a solid pen.<BR>	<BR>		<LI><TT>PS_DOT</TT>: Creates a dotted pen. This style is also valid only for pens	with a width of one. Wider pens are drawn as <TT>PS_SOLID</TT>.<BR>	<BR>		<LI><TT>PS_DASH</TT>: Creates a dashed pen. If the pen width is greater than one,	the pen is drawn as <TT>PS_SOLID</TT>.<BR>	<BR>		<LI><TT>PS_DASHDOT</TT>: Creates a pen with alternating dashes and dots. If the pen	width is greater than one, a solid pen is drawn instead.<BR>	<BR>		<LI><TT>PS_DASHDOTDOT</TT>: Creates a pen with alternating dashes and double dots.	If the pen width is greater than one, a solid pen is drawn instead.<BR>	<BR>		<LI><TT>PS_NULL</TT>: Creates a null pen; this pen doesn't draw at all.<BR>	<BR>		<LI><TT>PS_INSIDEFRAME</TT>: Creates a pen that draws a line inside the frame of	closed shapes produced by GDI functions, such as the <TT>Ellipse</TT> and <TT>Rectangle</TT>	functions.<BR>	<BR>		<LI><TT>PS_ALTERNATE</TT>: Can be applied only to cosmetic pens and creates a pen	that sets every other pixel.</UL><P>Figure 12.1 shows examples of each of the pen styles.</P><P><A NAME="01"></A><A HREF="01.htm"><B>Figure 12.1.</B></A> <I><BR>Examples of the styles available for pens.</I><H3><FONT COLOR="#000077"><B>Using Geometric Pens</B></FONT></H3><P>Geometric pens can use all the styles available for cosmetic pens except for the<TT>PS_ALTERNATE</TT> style, and they also have access to four additional attributes:<UL>	<LI>A pattern used to draw the pen<BR>	<BR>		<LI>A hatch style used for some types of patterns<BR>	<BR>		<LI>The type of end cap used to terminate a line<BR>	<BR>		<LI>A joining style, used when two lines intersect</UL><H3><FONT COLOR="#000077"><B>Using the <TT>CPen</TT> Class</B></FONT></H3><P>The <TT>CPen</TT> class is simple because there really are only a few things thatcan be done to a pen object; most of the fun occurs when the pen object is selectedinto a device context. The <TT>CPen</TT> class provides three constructors: two simpleconstructors primarily for cosmetic pens and another extremely flexible constructorprimarily for geometric pens.</P><P>The first constructor has no arguments:</P><PRE><FONT COLOR="#0066FF"><TT>CPen    aGreenPen;</TT><TT>aGreenPen.Create( PS_SOLID, 1, RGB(0,255,0);</TT></FONT></PRE><P>If you use this constructor, use the <TT>Create</TT> member function to actuallycreate the pen and make it ready for use.</P><P>The second constructor provided for <TT>CPen</TT> also is used for cosmetic pens:</P><PRE><FONT COLOR="#0066FF"><TT>CPen    penDottedAndRed( PS_DOT, 1, RGB(255,0,0) );</TT></FONT></PRE><P>This version of the constructor accepts three parameters: the pen style, width,and color. In this case, the <TT>CPen</TT> instance is a dotted red pen.</P><P>The third constructor used for <TT>CPen</TT> objects enables any type of pen tobe created. It also uses more parameters, as shown in Listing 12.1.<H4><FONT COLOR="#000077">TYPE: Listing 12.1. Creating a brush using a LOGBRUSH structure.</FONT></H4><PRE><FONT COLOR="#0066FF"><TT>LOGBRUSH    lbrGrnHatch;</TT><TT>lbrGrnHatch.lbStyle = BS_HATCHED;</TT><TT>lbrGrnHatch.lbColor = RGB(0,255,0);</TT><TT>lbrGrnHatch.lbHatch = HS_DIAGCROSS;</TT><TT>CPen    penGeometric( PS_DOT | PS_GEOMETRIC | PS_ENDCAPROUND,</TT><TT>                      50,</TT><TT>                      &amp;lbrGrnHatch,</TT><TT>                      0,</TT><TT>                      NULL );</TT></FONT></PRE><P>The constructor's first parameter is the pen's style, with the C++ <TT>OR</TT>operator, <TT>|</TT>, used to combine all styles that are applied to the pen. Thesecond parameter for the constructor is the width; if the pen is cosmetic, it mustbe set to 1. The third parameter is a pointer to a <TT>LOGBRUSH</TT> structure. InListing 12.1, <TT>lbrGrnHatch</TT> is defined as a diagonally cross-hatched greenbrush.</P><P>The last two parameters are rarely used; they define a user-supplied pattern forthe pen. These two parameters are used only if the pen is created with the <TT>PS_USERSTYLE</TT>attribute. The fourth parameter is the number of elements in the style array, whereasthe fifth parameter is an array of <TT>DWORD</TT> values, each used to define thelength of a dash or space in the pen's pattern.<H3><FONT COLOR="#000077"><B>Using Stock Pens</B></FONT></H3><P>The simplest pens to use are known as <I>stock objects</I>. Stock objects werediscussed in Hour 11; they are GDI objects that belong to the operating system. Windowsprovides three stock pens:<UL>	<LI><TT>BLACK_PEN</TT>: Provides, oddly enough, a black pen<BR>	<BR>		<LI><TT>WHITE_PEN</TT>: Provides a white pen<BR>	<BR>		<LI><TT>NULL_PEN</TT>: Provides a null pen and is exactly the same as creating a	pen with the <TT>PS_NULL</TT> style</UL><P>Each of these pens is exactly one unit wide. If you need a wider pen, you mustcreate one using the <TT>CPen</TT> class. These pens are used through a <TT>CDC</TT>object by calling the <TT>SelectStockObject</TT> function, passing the stock objectas a parameter, as follows:</P><PRE><FONT COLOR="#0066FF"><TT>CPen* pOldPen = pDC-&gt;SelectStockObject( BLACK_PEN );</TT></FONT></PRE><H2><FONT COLOR="#000077"><B>An Example that Draws with Pens</B></FONT></H2><P>After a pen has been selected into a device context, several different drawingfunctions can be performed with the device context. The <TT>CDC</TT> class used torepresent device contexts, as you learned in Hour 11, includes these drawing functionsoften used with pens:

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
欧美欧美午夜aⅴ在线观看| 一区二区三区在线免费| 中文字幕亚洲不卡| 亚洲成av人在线观看| 国产精品1区2区3区在线观看| 91女神在线视频| 亚洲精品一区二区三区影院 | 亚洲精品国产一区二区精华液| 日本午夜精品视频在线观看 | 欧美xfplay| 一区二区三区在线看| 国产91色综合久久免费分享| 日韩一二三四区| 性久久久久久久久| 色综合色狠狠天天综合色| 久久免费国产精品 | 亚洲欧美国产毛片在线| 国产大陆精品国产| 亚洲女与黑人做爰| 国产凹凸在线观看一区二区| 日韩欧美国产三级电影视频| 视频一区二区三区中文字幕| 色噜噜夜夜夜综合网| 国产三级久久久| 久久精品国产99| 欧美一区三区四区| 婷婷久久综合九色综合伊人色| 91欧美激情一区二区三区成人| 国产欧美日韩在线看| 国产一区在线观看麻豆| 久久―日本道色综合久久| 狠狠色丁香久久婷婷综合丁香| 欧美人xxxx| 日韩激情视频网站| 91精品国产综合久久久久久漫画| 亚洲国产精品影院| 欧美色图激情小说| 午夜精品久久久久久| 欧美日韩精品福利| 麻豆精品视频在线观看免费| 日韩三级视频中文字幕| 国产在线视频一区二区三区| 精品国产露脸精彩对白| 国产成人精品免费看| 中文一区在线播放| 91美女福利视频| 亚洲第一福利视频在线| 欧美一区二区三区在线看| 国产自产v一区二区三区c| 日韩国产在线一| 91麻豆精品久久久久蜜臀| 青草国产精品久久久久久| 欧美刺激午夜性久久久久久久| 另类小说欧美激情| 国产精品日日摸夜夜摸av| 色视频成人在线观看免| 久久精品国产亚洲aⅴ| 国产欧美日韩视频一区二区| 一本到一区二区三区| 日韩在线观看一区二区| 精品久久五月天| 成人精品视频一区二区三区| 一区二区在线观看av| 9191精品国产综合久久久久久| 精品中文字幕一区二区小辣椒| 国产欧美日韩视频一区二区| 日本乱人伦一区| 精品制服美女丁香| 国产精品久久久久影院| 欧美猛男超大videosgay| 久久激情五月激情| 亚洲美腿欧美偷拍| 日韩一区二区三区电影| 99国产精品一区| 极品美女销魂一区二区三区| 亚洲免费在线播放| 日韩美女一区二区三区四区| 97精品电影院| 久久精品国产成人一区二区三区 | 国产日产欧产精品推荐色| 91成人网在线| 国产精品99久久久久| 亚洲小少妇裸体bbw| 日本一二三四高清不卡| 欧美一区二区三区四区久久| 91美女蜜桃在线| 国产在线精品国自产拍免费| 亚洲一区二区三区中文字幕| 欧美国产一区在线| 欧美成人一区二区三区在线观看| 在线一区二区三区| 成人午夜视频福利| 国产综合久久久久久鬼色| 日韩精品视频网| 成人免费一区二区三区在线观看| 欧美成人精品高清在线播放| 欧美性生交片4| 99re8在线精品视频免费播放| 精品在线你懂的| 视频一区二区欧美| 亚洲综合色自拍一区| 国产精品不卡视频| 国产精品美女一区二区| 久久久精品日韩欧美| 精品国产1区二区| 日韩一区二区在线看片| 欧美日本一区二区| 欧美午夜寂寞影院| 在线观看不卡视频| 在线亚洲精品福利网址导航| 91网页版在线| 99精品久久只有精品| 成人av电影在线网| 成人h动漫精品一区二区| 国产aⅴ综合色| 国产成人亚洲综合a∨婷婷| 久久99精品国产麻豆婷婷 | 91精品国产综合久久久蜜臀图片| 在线观看免费成人| 色猫猫国产区一区二在线视频| 成人h精品动漫一区二区三区| 成人黄色软件下载| 懂色av一区二区夜夜嗨| 国产精品中文有码| 成人永久看片免费视频天堂| 不卡一卡二卡三乱码免费网站| 成人99免费视频| 色综合中文字幕| 欧美视频在线一区二区三区 | 国产精品一区一区三区| 国产一区二区不卡| 国产成人av自拍| www.日韩av| 欧美日韩一二三| 日韩欧美在线影院| 久久精品亚洲精品国产欧美| 国产精品天美传媒| 亚洲精品少妇30p| 日本欧美一区二区在线观看| 精品无人码麻豆乱码1区2区| 成人一区二区三区| 在线日韩国产精品| 欧美成人福利视频| 国产精品久久久一区麻豆最新章节| 亚洲日本在线看| 青草国产精品久久久久久| 国产精品资源在线看| 91视视频在线观看入口直接观看www| 在线观看日韩精品| 久久久久久久久一| 亚洲一卡二卡三卡四卡| 美女一区二区三区在线观看| 粉嫩av一区二区三区粉嫩| 欧美色综合影院| 久久久精品影视| 亚洲成人一区二区| 国产成人午夜高潮毛片| 欧美性xxxxxx少妇| 久久精品网站免费观看| 亚洲国产一区二区a毛片| 国产综合久久久久久鬼色| 色88888久久久久久影院野外| 欧美v日韩v国产v| 一区二区三区欧美视频| 国产盗摄女厕一区二区三区| 欧美探花视频资源| 日本一区二区动态图| 日本中文字幕一区二区有限公司| 国产精品亚洲一区二区三区在线| 欧美在线观看一区| 国产欧美日韩三区| 七七婷婷婷婷精品国产| 91久久精品国产91性色tv | 亚洲一线二线三线视频| 国产99精品视频| 91精选在线观看| 亚洲一级在线观看| 91在线码无精品| 欧美激情在线看| 国产一区二区三区免费播放| 欧美人与禽zozo性伦| 一区二区成人在线视频| 成人精品亚洲人成在线| 久久久久青草大香线综合精品| 蜜桃av一区二区三区| 欧美日韩国产综合一区二区三区| 中文子幕无线码一区tr| 大陆成人av片| 欧美国产一区视频在线观看| 国产一区在线观看麻豆| 欧美videos中文字幕| 久久99久久99精品免视看婷婷| 日韩一级在线观看| 免费成人性网站| 欧美男人的天堂一二区| 日韩主播视频在线| 欧美一区二区三区免费观看视频| 亚洲国产精品久久艾草纯爱 | 99综合电影在线视频| 精品第一国产综合精品aⅴ|