21 ...</codeblock> <p>The center point is drawn in the second arc example to clarify arc construction. </p> <section><title>How to draw an ellipse</title> <p>You can use <codeph>DrawEllipse()</codeph> to draw an ellipse. </p> <codeblock id="GUID-076DE9D4-9F7F-56E7-8A13-AA546C8672E2" xml:space="preserve">... |
21 ...</codeblock> <p>The center point is drawn in the second arc example to clarify arc construction. </p> <section><title>How to draw an ellipse</title> <p>You can use <codeph>DrawEllipse()</codeph> to draw an ellipse. </p> <codeblock id="GUID-076DE9D4-9F7F-56E7-8A13-AA546C8672E2" xml:space="preserve">... |
22 // draw an ellipse centered in the rectangle |
22 // draw an ellipse centered in the rectangle |
23 gc.DrawEllipse(ellipseRect); |
23 gc.DrawEllipse(ellipseRect); |
24 ...</codeblock> </section> <section><title>How to draw an arc</title> <p>An arc is drawn as a portion of an ellipse. As well as the ellipse rectangle, the call must specify the two points: the first defines one end of a line from the geometric center of the ellipse; the point of intersection between this line and the ellipse defines the start point of the arc. The second specified point acts in the same way for the end of the arc. </p> <fig id="GUID-ED34ADD7-004F-5BE6-822F-B5592E4F1A9A"><title> |
24 ...</codeblock> </section> <section><title>How to draw an arc</title> <p>An arc is drawn as a portion of an ellipse. As well as the ellipse rectangle, the call must specify the two points: the first defines one end of a line from the geometric center of the ellipse; the point of intersection between this line and the ellipse defines the start point of the arc. The second specified point acts in the same way for the end of the arc. </p> <fig id="GUID-ED34ADD7-004F-5BE6-822F-B5592E4F1A9A"><title> |
25 Arc construction |
25 Arc construction |
26 </title> <image href="GUID-6A5D0445-5D53-5293-A501-136203C80BEE_d0e264217_href.png" placement="inline"/></fig> <p>The example code here shows how an arc is drawn in an anti-clockwise direction using <codeph>constructionPoint1</codeph> and <codeph>constructionPoint2</codeph> as the start to the end points. </p> <codeblock id="GUID-956A154F-EE60-5286-97BA-B05ABBA2C949" xml:space="preserve">... |
26 </title> <image href="GUID-6A5D0445-5D53-5293-A501-136203C80BEE_d0e261097_href.png" placement="inline"/></fig> <p>The example code here shows how an arc is drawn in an anti-clockwise direction using <codeph>constructionPoint1</codeph> and <codeph>constructionPoint2</codeph> as the start to the end points. </p> <codeblock id="GUID-956A154F-EE60-5286-97BA-B05ABBA2C949" xml:space="preserve">... |
27 // draw an arc centered in the rectangle |
27 // draw an arc centered in the rectangle |
28 gc.DrawArc(ellipseRect,constructionPoint1,constructionPoint2); |
28 gc.DrawArc(ellipseRect,constructionPoint1,constructionPoint2); |
29 ...</codeblock> <p>You can reverse the pair of construction point arguments to draw the other half of the ellipse. The construction points and screen center are also drawn, with dotted construction lines: </p> <codeblock id="GUID-CAB960B4-66DC-5996-9D2E-094B0171BFB5" xml:space="preserve">... |
29 ...</codeblock> <p>You can reverse the pair of construction point arguments to draw the other half of the ellipse. The construction points and screen center are also drawn, with dotted construction lines: </p> <codeblock id="GUID-CAB960B4-66DC-5996-9D2E-094B0171BFB5" xml:space="preserve">... |
30 // draw an arc centered in the rectangle |
30 // draw an arc centered in the rectangle |
31 // that is the other portion of the ellipse |
31 // that is the other portion of the ellipse |
40 gc.Plot(constructionPoint1); |
40 gc.Plot(constructionPoint1); |
41 gc.Plot(constructionPoint2); |
41 gc.Plot(constructionPoint2); |
42 gc.Plot(screenCenterPoint); |
42 gc.Plot(screenCenterPoint); |
43 ...</codeblock> </section> <section><title>Drawing pie slices</title> <p>The example code here shows how two pie slices are drawn. A pie slice is the area bounded by: </p> <p>an arc as used above </p> <p>the straight line from the start point from the geometric center of the ellipse </p> <p>the straight line from the end point from the geometric center of the ellipse </p> <fig id="GUID-71C67896-8B38-5D1E-B34A-0425CF135915"><title> |
43 ...</codeblock> </section> <section><title>Drawing pie slices</title> <p>The example code here shows how two pie slices are drawn. A pie slice is the area bounded by: </p> <p>an arc as used above </p> <p>the straight line from the start point from the geometric center of the ellipse </p> <p>the straight line from the end point from the geometric center of the ellipse </p> <fig id="GUID-71C67896-8B38-5D1E-B34A-0425CF135915"><title> |
44 Pie slice construction |
44 Pie slice construction |
45 </title> <image href="GUID-20B364FB-FC12-5EF1-B0EC-1A845693EFFD_d0e264258_href.png" placement="inline"/></fig> <p>Solid and patterned brush styles are used to fill the portions of the elliptical disc. </p> <ol id="GUID-8A734874-8E67-5ABF-9C65-308B136D25D4"><li id="GUID-31A563CE-3043-5713-9FBA-A42C6902F544"><p>Use <codeph>SetBrushStyle()</codeph> to set the brush style to solid. </p> </li> <li id="GUID-0F8D5C04-DD38-5B8A-9BAA-B2E9F9C53C1E"><p>Use <codeph>SetBrushColour()</codeph> to set the brush color to black. </p> </li> <li id="GUID-6EDBBFE4-640C-5E40-8AFE-8B0E99F843A3"><p>Use <codeph>DrawPie()</codeph> to draw a pie slice. </p> </li> <li id="GUID-5ADA6FF4-D9B8-5624-AE74-8C58FF06B624"><p>Use <codeph>SetBrushStyle()</codeph> to set the patterned brush style. </p> </li> <li id="GUID-FA09E650-1E1E-5565-8329-41490F77A974"><p>Use <codeph>DrawPie()</codeph> and reverse the pair of construction point arguments so that the two pie slices together form a whole ellipse. </p> </li> </ol> <codeblock id="GUID-79463D92-F260-52BD-BF5B-5917365E9C19" xml:space="preserve">... |
45 </title> <image href="GUID-20B364FB-FC12-5EF1-B0EC-1A845693EFFD_d0e261138_href.png" placement="inline"/></fig> <p>Solid and patterned brush styles are used to fill the portions of the elliptical disc. </p> <ol id="GUID-8A734874-8E67-5ABF-9C65-308B136D25D4"><li id="GUID-31A563CE-3043-5713-9FBA-A42C6902F544"><p>Use <codeph>SetBrushStyle()</codeph> to set the brush style to solid. </p> </li> <li id="GUID-0F8D5C04-DD38-5B8A-9BAA-B2E9F9C53C1E"><p>Use <codeph>SetBrushColour()</codeph> to set the brush color to black. </p> </li> <li id="GUID-6EDBBFE4-640C-5E40-8AFE-8B0E99F843A3"><p>Use <codeph>DrawPie()</codeph> to draw a pie slice. </p> </li> <li id="GUID-5ADA6FF4-D9B8-5624-AE74-8C58FF06B624"><p>Use <codeph>SetBrushStyle()</codeph> to set the patterned brush style. </p> </li> <li id="GUID-FA09E650-1E1E-5565-8329-41490F77A974"><p>Use <codeph>DrawPie()</codeph> and reverse the pair of construction point arguments so that the two pie slices together form a whole ellipse. </p> </li> </ol> <codeblock id="GUID-79463D92-F260-52BD-BF5B-5917365E9C19" xml:space="preserve">... |
46 // draw a pie slice centered in the rectangle |
46 // draw a pie slice centered in the rectangle |
47 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
47 gc.SetBrushStyle(CGraphicsContext::ESolidBrush); |
48 gc.SetBrushColor(black); |
48 gc.SetBrushColor(black); |
49 gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2); |
49 gc.DrawPie(ellipseRect,constructionPoint1,constructionPoint2); |
50 |
50 |