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

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

?? apf.htm

?? 21天學會VC的英文版
?? HTM
?? 第 1 頁 / 共 5 頁
字號:
<P>These lines create three new CPlanetDets type objects and add them to the array.The last line displays the diameter in the TRACE macro without needing to cast thereturned value from myPlanetArray[i] because it's already a pointer of the CPlanetDets*type.</P><P>However, later you might forget the exact nature of myPlanetArray and try to adda CStatic object instead:</P><P><PRE>myPlanetArray.Add(new CStatic());</PRE><P>Fortunately, the compiler will spot the transgression and issue a compiler errorsuch as</P><P><PRE>`Add' : cannot convert parameter 1 from `class &Acirc;CStatic *' to `class CPlanetDets *</PRE><P>However, the error wouldn't have been spotted if you had been using a CObArrayto hold the planet details:</P><P><PRE>CObArray myPlanetArray;</PRE><P>The CStatic object would be happily stored along with the CPlanetDets objects,causing untold havoc when you try to retrieve the CStatic object, thinking it's aCPlanetDets object.</P><P>The template used to generate type-safe lists is CList; it takes the same generalform as CArray:</P><P><PRE>CList&lt;CMyCustomClass*, CMyCustomClass *&gt; myCustomClassList;</PRE><P>Again, the first parameter is the required returned object type, and the secondparameter specifies the accepted object types for functions that accept elementsfor storage.</P><P>All the functions available for lists are available for your own specific type-safecustomized lists, again checking and returning your specified types. Therefore, theequivalent list-based code for the planet storing array would be coded like this:</P><P><PRE>CList&lt;CPlanetDets*,CPlanetDets*&gt; myPlanetList;myPlanetList.AddTail(new CPlanetDets  &Acirc;(4878, 0.054, 57.91, 87.969));myPlanetList.AddTail(new CPlanetDets  &Acirc;(12100, 0.815, 108.21, 224.701));myPlanetList.AddTail(new CPlanetDets  &Acirc;(12756, 1.000, 149.60, 365.256));POSITION pos = myPlanetList.GetHeadPosition();while(pos) TRACE(&quot;Diameter = %f\n&quot;,myPlanetList.</PRE><H3><A NAME="Heading5"></A>&Acirc;GetNext(pos)-&gt;m_dDiameter);</H3><P>The template for customized maps differs from the list and arrays in that it needsfour parameters: an input and a return value for both the key and element value.So the general form is like this:</P><P><PRE>CMap&lt;MyType, MyArgType, CMyCustomClass *, CMyCustomClassArg *&gt;myCustomClassMap;</PRE><P>The first parameter, MyType, specifies the internally stored key value for eachmap association. This can be any of the basic types such as int, WORD, DWORD, double,float, or CString, or it can be a pointer to your own specific type.</P><P>The second parameter, MyArgType, specifies the argument type used to pass keyvalues in and out of the map functions.</P><P>The third parameter, CMyCustomClass *, is how you want the internal element valuesto be stored (as specific type-safe pointers to your objects).</P><P>The fourth parameter, CMyCustomClassArg *, specifies the argument type used topass your element values in and out of the map functions. For example, to associatethe planet details with their names, you might code the following:</P><P><PRE>CMap&lt;CString,LPCSTR,CPlanetDets*,CPlanetDets*&gt; myPlanetMap;myPlanetMap.SetAt(&quot;Mercury&quot;,          new CPlanetDets(4878, 0.054, 57.91, 87.969));myPlanetMap.SetAt(&quot;Venus&quot;,          new CPlanetDets(12100, 0.815, 108.21, 224.701));myPlanetMap.SetAt(&quot;Earth&quot;,          new CPlanetDets(12756, 1.000, 149.60, 365.256));CPlanetDets* pPlanet = NULL;if (myPlanetMap.Lookup(&quot;Venus&quot;,pPlanet))TRACE(&quot;Diameter = %f\n&quot;,pPlanet-&gt;m_dDiameter);</PRE><P>The map declaration indicates that the objects should be stored internally asCStrings but use LPCSTR (pointers to constant character arrays) to pass values intoand out of the map. The planet's details themselves will be both stored internallyand accessed as pointers to CPlanetDets objects (such as CPlanetDets*).</P><BLOCKQUOTE>	<P><HR><B>POTENTIAL PROBLEMS WHEN USING THE MAP'S INTERNAL HASH KEY TYPES</B></P>	<P>You must be wary of the conversion between the passed parameters and the internal	hash key storage system. For example, if you were to replace the CString in the previous	example with another LPCSTR for the internal storage object, the Lookup() would fail	to find &quot;Venus&quot; because it would be comparing the pointer values (to different	instances of &quot;Venus&quot;) rather than the contents of the strings. <HR></BLOCKQUOTE><H2><A NAME="Heading6"></A>Using the Coordinate-Handling Classes</H2><P>Because Windows is a graphically oriented environment, you'll often need to holdpoint positions, rectangles, and sizes. Three MFC classes help store and manipulatethese coordinates: CPoint, CRect, and CSize. Each has several member functions andoperator overloads that take much of the work out of adding, constructing, and findingderivatives of these coordinates.</P><P>Also several of the MFC and GDI functions understand their types or underlyingtypes as parameter values, so you don't have to perform any messy mangling operationsto pass them into functions.</P><P><H3><A NAME="Heading7"></A>Using the CPoint Class</H3><P>CPoint encapsulates a POINT structure that just holds an x and y position to representa point on a two-dimensional surface. You can always access x and y members directlyto get or set their current values like this:</P><P><PRE>CPoint ptOne;ptOne.x = 5;ptOne.y = 20;TRACE(&quot;Co-ordinate = (%d,%d)\n&quot;,ptOne.x,ptOne.y);</PRE><P>You set these values when you construct a CPoint object by passing values to oneof CPoint's several constructors, as shown in Table F.4.</P><P><H4>TABLE F.4.&nbsp;CONSTRUCTOR TYPES FOR THE CPoint CLASS.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Constructor Definition</I></TD>		<TD ALIGN="LEFT"><I>Description</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CPoint()</TD>		<TD ALIGN="LEFT">Constructs an uninitialized object</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CPoint(POINT ptInit)</TD>		<TD ALIGN="LEFT">Copies the settings from a POINT structure or another CPoint object</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CPoint(int x, int y)</TD>		<TD ALIGN="LEFT">Initializes the object from the x and y parameter values</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CPoint(DWORD dwInit)</TD>		<TD ALIGN="LEFT">Uses the low 16 bits for the x value and the high 16 bits for the y value</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CPoint(SIZE sizeInit)</TD>		<TD ALIGN="LEFT">Copies the settings from a SIZE structure or CSize object</TD>	</TR></TABLE></P><P>For example, you could replace the last sample lines with these for the same result:</P><P><PRE>CPoint ptOne(5,20);TRACE(&quot;Co-ordinate = (%d,%d)\n&quot;,ptOne.x,ptOne.y);</PRE><P>One of the most useful aspects of the CPoint class is its many operator overloads.By using the +, -, +=, and -= operators with other CPoint, CRect, or CSize objects,you can add or subtract coordinate pairs from other coordinate pairs or from rectanglesor sizes. For example, the long way to subtract two points from each other to givea third would be like this:</P><P><PRE>CPoint ptOne(5,20);CPoint ptTwo(25,40);CPoint ptThree;ptThree.x = ptTwo.x - ptOne.x;ptThree.y = ptTwo.y - ptOne.y;</PRE><P>This can be simplified by using the operator overload:</P><P><PRE>CPoint ptOne(5,20);CPoint ptTwo(25,40);CPoint ptThree = ptTwo - ptOne;</PRE><P>Or you can add the coordinates of one point to another like this:</P><P><PRE>ptTwo += ptOne;</PRE><P>You can also use the == and != logical operator overloads to perform comparisons.For example, to check whether ptTwo is equal to ptOne in both x and y values, youcan code the following:</P><P><PRE>if (ptOne == ptTwo) TRACE(&quot;Points are the same&quot;);</PRE><P>There is also an Offset() function that adds an offset value specified by passingx and y values, or a CPoint class or POINT structure, or a CSize or SIZE structure.Therefore, the following two lines are functionally identical:</P><P><PRE>ptOne.Offset(75,-15);ptOne-=CPoint(-75,15);</PRE><H3><A NAME="Heading8"></A>Using the CRect Class</H3><P>The CRect class encapsulates a RECT structure to hold two pairs of coordinatesthat describe a rectangle by its top-left point and its bottom-right point. You canconstruct a CRect object using one of its several constructors, as shown in TableF.5.</P><P><H4>TABLE F.5.&nbsp;CONSTRUCTOR TYPES FOR THE CRect CLASS.</H4><P><TABLE BORDER="1">	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT"><I>Constructor Definition</I></TD>		<TD ALIGN="LEFT"><I>Description</I></TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect()</TD>		<TD ALIGN="LEFT">Constructs an uninitialized object</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect(const RECT&amp; rcInit)</TD>		<TD ALIGN="LEFT">Copies the settings from another RECT structure or CRect object</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect(LPCRECT lprcInit)</TD>		<TD ALIGN="LEFT">Copies the settings via a RECT or CRect pointer</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect(int l,int t,int r,int b)</TD>		<TD ALIGN="LEFT">Initializes the coordinates from left, top, right, and bottom parameters</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect(POINT point, SIZE size)</TD>		<TD ALIGN="LEFT">Initializes from a POINT or CPoint and a SIZE or CSize</TD>	</TR>	<TR ALIGN="LEFT" VALIGN="TOP">		<TD ALIGN="LEFT">CRect(POINT ptTL, POINT ptBR)</TD>		<TD ALIGN="LEFT">Initializes from a top-left POINT and a bottom-right POINT</TD>	</TR></TABLE></P><P>After you've constructed a CRect object, you can access each of the top, left,bottom, and right members individually using the (LPRECT) cast to cast it into aRECT structure as shown in these lines:</P><P><PRE>CRect rcOne(15,15,25,20); ((LPRECT)rcOne)-&gt;bottom += 20;TRACE(&quot;Rect is (%d,%d)-(%d,%d)&quot;,((LPRECT)rcOne)-&gt;left,((LPRECT)rcOne)-&gt;top,        ((LPRECT)rcOne)-&gt;right,((LPRECT)rcOne)-&gt;bottom);</PRE><P>Alternatively, you can access the members via either the top-left CPoint or thebottom-right CPoint. References to these member objects are returned by the TopLeft()and BottomRight() functions. When you've accessed either the top-left or bottom-rightpoints, you can then manipulate them using any of the CPoint functions shown in theprevious section. For example, the following lines are functionally identical tothe previous lines, but differ in that they construct and access the rectangle usingCPoint objects:</P><P><PRE>CRect rcOne(CPoint(15,15),CPoint(25,20));rcOne.BottomRight().y += 20;TRACE(&quot;Rect is (%d,%d)-(%d,%d)&quot;,    rcOne.TopLeft().x,rcOne.TopLeft().y,    rcOne.BottomRight().x,rcOne.BottomRight().y);</PRE><P>You can also use the SetRect() function to set the coordinates by passing fourintegers to represent the top-left x- and y-coordinates and the bottom-right x- andy-coordinates. SetRectEmpty() sets all these coordinates to zero to make a NULL rectangle.The IsRectNull() function will return TRUE if called on such a NULL rectangle, andIsRectEmpty() will return TRUE if the width and height are both zero (even if theindividual values are not zero).</P><P>Several helper functions help you calculate various aspects of the rectangle'sgeometry. The width and height can be found by calling the Width()and Height() functions,each of which returns the relevant integer value. Alternatively, you can find a CSizethat represents both width and height by calling the Size() function. For example,the following line displays the width and height of the rectangle rcOne:</P><P><PRE>TRACE(&quot;Rect Width = %d, Height = %d\n&quot;,                     rcOne.Width(), rcOne.Height());</PRE><P>The point in the center of the rectangle is often a useful coordinate to know;you can find this by calling the CenterPoint() function, which returns a CPoint objectto represent the center of the rectangle.</P><P>You might use this to find the center of your window's client area and draw adot there like this:</P><P><PRE>CRect rcClient;GetClientRect(&amp;rcClient);dc.SetPixel(rcClient.CenterPoint(),0);</PRE><P>You can also find the union or intersection of two rectangles by calling UnionRect()and InterSectRect(), which both take two source rectangles as parameters and setthe coordinates of the calling CRect object to the union or intersection. The unionis the smallest rectangle that will enclose the two source rectangles. The intersectionis the largest rectangle that is enclosed by both source rectangles. The diagramin Figure F.1 shows the union and intersection of two source rectangles labeled Aand B.</P><P><A HREF="javascript:popUp('33fig01.gif')"><B>FIGURE F.1.</B></A><B> </B><I>Theunion and intersection between two rectangles.</I></P><P>The following lines calculate the intersection and union of the source rectanglesrcOne and rcTwo:</P><P><PRE>CRect rcOne(10,10,100,100);CRect rcTwo(50,50,150,200);CRect rcUnion, rcIntersect;rcUnion.UnionRect(rcOne,rcTwo);rcIntersect.IntersectRect(rcOne,rcTwo);</PRE><P>When this code is run, rcUnion will be set to coordinates (10,10)-(150,200) andrcIntersect will be set to coordinates (50,50)-(100,100).</P><P>You can use SubtractRect() to find the subtraction of one rectangle from another.This is the smallest rectangle that contains all the points not intersected by thetwo source rectangles (or the smallest non-overlapping section). For example, byadding the following lines to an OnPaint() handler, you can see the effects of SubtractRect()to subtract rcTwo from rcOne to produce rcDst. The resulting subtraction is the sectionthat will be drawn in blue at the bottom of the diagram, as shown in Figure F.2.</P><P><PRE>CRect rcOne(10,10,220,220), rcTwo(50,50,150,260), rcDst;rcDst.SubtractRect(rcTwo,rcOne);dc.FillSolidRect(rcOne,RGB(255,0,0));//reddc.FillSolidRect(rcTwo,RGB(0,255,0));//greendc.FillSolidRect(rcDst,RGB(0,0,255));//blue

?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人动漫av在线| 激情欧美一区二区三区在线观看| 亚洲影视在线观看| 成人av午夜电影| 懂色av一区二区三区免费看| 欧美中文字幕一区| 欧美日韩精品欧美日韩精品一综合| 色婷婷激情一区二区三区| 97se亚洲国产综合在线| 久久影院视频免费| 久久久美女毛片| 国产精品久久久久久久第一福利 | 韩国三级在线一区| 欧美日韩国产在线观看| 中文字幕日韩欧美一区二区三区| 国产精品蜜臀av| 亚洲精品乱码久久久久久黑人| 久久99国产乱子伦精品免费| 欧美精品日韩一区| 亚洲精品在线一区二区| 日韩av在线发布| 国产一区 二区| 欧美一级爆毛片| 国产亚洲欧美日韩在线一区| 一色屋精品亚洲香蕉网站| 自拍偷拍欧美精品| 亚洲午夜激情av| 久久激五月天综合精品| 国产精品一级二级三级| 久久午夜羞羞影院免费观看| 中文字幕在线不卡一区二区三区| 亚洲已满18点击进入久久| 色美美综合视频| 亚洲精品欧美综合四区| 日韩av电影天堂| 欧美巨大另类极品videosbest| 久久久久亚洲蜜桃| 国产精品乡下勾搭老头1| 欧美系列一区二区| 亚洲一区二区3| 欧美特级限制片免费在线观看| 一区二区三区免费在线观看| 久久99精品久久久久婷婷| 成人午夜av在线| 国产精品美女久久福利网站| 亚洲成人自拍偷拍| 欧美一区二区三区视频| 精品一二三四区| 国产亚洲欧美日韩在线一区| 日韩电影免费在线| 91看片淫黄大片一级| 亚洲免费高清视频在线| 欧美日产在线观看| 自拍视频在线观看一区二区| 久久国产精品99久久人人澡| 91色乱码一区二区三区| 亚州成人在线电影| 欧美大胆一级视频| 欧美第一区第二区| 一区二区三区日韩精品| 成人免费黄色大片| 一级精品视频在线观看宜春院 | 久久精品亚洲乱码伦伦中文| 肉肉av福利一精品导航| 成人av资源站| 午夜日韩在线电影| 精品福利一区二区三区 | 亚洲免费资源在线播放| 高清不卡在线观看av| 欧美一区二区三区在线电影| 国产麻豆欧美日韩一区| 亚洲第一在线综合网站| 色就色 综合激情| 国产精品久久久久影视| 91精品国产麻豆国产自产在线| 国产v综合v亚洲欧| 欧美国产视频在线| 欧美日韩成人综合在线一区二区| 国模少妇一区二区三区| 亚洲国产视频网站| 国产精品成人免费在线| 这里只有精品免费| 日本va欧美va欧美va精品| 中文字幕一区二区三区蜜月 | 免费看日韩精品| 亚洲人成影院在线观看| 久久精品亚洲麻豆av一区二区| 黑人精品欧美一区二区蜜桃| 日韩欧美不卡在线观看视频| 色偷偷成人一区二区三区91 | 激情综合网最新| 性做久久久久久久免费看| 亚洲色图在线看| 日本一区二区三区在线观看| 91精品国产综合久久久久久| 免费xxxx性欧美18vr| 日韩一级完整毛片| 欧美无乱码久久久免费午夜一区| 国产成人在线色| 久久er99热精品一区二区| 婷婷综合另类小说色区| 一区二区三区四区激情| 亚洲男女毛片无遮挡| 国产精品福利影院| 欧洲精品在线观看| 不卡av在线网| 国产激情一区二区三区四区 | 日本不卡不码高清免费观看| 亚洲国产视频网站| 精品免费99久久| 日韩欧美一级特黄在线播放| 欧美一级夜夜爽| 日韩亚洲欧美一区| 91精品国产乱码久久蜜臀| 国产一区二区不卡在线 | 欧美电视剧免费观看| 717成人午夜免费福利电影| 国产在线视频不卡二| 日本美女一区二区三区视频| 亚洲国产精品一区二区www在线 | 久久99精品国产麻豆婷婷| 久久精品国产精品亚洲红杏| 国产精品久久久久婷婷二区次| 国产精品久久综合| 777午夜精品视频在线播放| 国产成人精品三级麻豆| 国产91丝袜在线观看| 成人av在线播放网址| 色婷婷精品久久二区二区蜜臂av| 久久国产乱子精品免费女| 免费观看在线综合| 亚洲精品少妇30p| 26uuu精品一区二区三区四区在线| 91色乱码一区二区三区| 日本韩国欧美在线| 欧美一级黄色片| 久久久久久久久久久久电影| 中文字幕久久午夜不卡| 亚洲综合成人在线视频| 日本一区二区三区四区| 亚洲乱码国产乱码精品精可以看| 一区二区三区中文字幕电影| 日韩中文字幕麻豆| 亚洲综合男人的天堂| 久色婷婷小香蕉久久| 国产成人精品亚洲日本在线桃色| 日韩中文字幕1| 一区二区三区成人| 中文字幕亚洲区| 婷婷久久综合九色综合绿巨人| 亚洲视频在线观看一区| 国产午夜精品在线观看| 亚洲欧美成人一区二区三区| 天堂一区二区在线| 亚洲国产一二三| 国产一区不卡视频| 经典三级视频一区| 精品亚洲porn| 91首页免费视频| 欧美成人激情免费网| 亚洲视频免费在线观看| 久久福利资源站| 欧美中文字幕一区| 国产午夜亚洲精品午夜鲁丝片| 亚洲成av人片观看| 成人免费观看男女羞羞视频| 国产成人精品免费看| 国产美女主播视频一区| 国产永久精品大片wwwapp| 欧美亚洲日本一区| 亚洲国产精品t66y| 国产精品久久久久久久久动漫| 蜜臀av性久久久久蜜臀aⅴ流畅| 99re视频精品| 国产欧美日韩久久| 精东粉嫩av免费一区二区三区| 国产一区二区三区综合| 欧美精品色一区二区三区| 亚洲欧美中日韩| 亚洲最色的网站| 成人综合在线网站| 久久综合一区二区| 中文字幕乱码久久午夜不卡| 17c精品麻豆一区二区免费| 一区二区三区在线影院| 午夜婷婷国产麻豆精品| 色婷婷精品大在线视频| 欧美视频在线观看一区| 日韩一区二区三区视频在线| 久久久精品tv| 欧美日韩综合不卡| 亚洲女同女同女同女同女同69| 亚洲综合av网| 91久久精品网| 亚洲视频免费在线| 色狠狠一区二区| 91精品欧美久久久久久动漫 | 亚洲欧美在线视频| 夜夜爽夜夜爽精品视频| 蜜桃久久av一区|