Windows CE allows you to draw lines and a variety of filled shapes including an ellipse, a polygon, a rectangle, and a rounded rectangle.
A line is a set of highlighted pixels on a raster display or a set of dots on a printed page identified by two points: a starting point and an ending point. In Windows CE, the pixel located at the starting point is always included in the line, and the pixel located at the ending point is always excluded.
You can draw a series of connected line segments by calling the Polyline function and supplying an array of points that specify the ending point of each line segment.
Note Windows CE does not support the LineTo or the MoveToEx functions. However, you can use the Polyline function in Windows CE to achieve the same results that you would get in Windows-based desktop platforms if you called the MoveToEx function and then made repeated calls to the LineTo function.
Filled shapes are geometric shapes that Windows CE outlines with the current pen and fills with the current brush. Windows CE supports four filled shapes: ellipse, polygon, rectangle, and round rectangle, which is a rectangle with rounded corners.
An application written for Windows uses filled shapes in a variety of ways. Spreadsheet applications, for example, use filled shapes to construct charts and graphs; drawing applications allow users to draw figures and illustrations using filled shapes.
An ellipse is a closed curve defined by two fixed points — f1 and f2 — such that the sum of the distances — d1 + d2 — from any point on the curve to the two fixed points is constant. The following illustration describes an ellipse drawn by using the Ellipse function.
Result of the Ellipse function
When calling Ellipse, you supply the coordinates of the upper left and lower right corners of the ellipse's bounding rectangle. A bounding rectangle is the smallest rectangle that completely surrounds the ellipse.
A polygon is a filled shape with straight sides. Windows CE uses the currently selected pen to draw the sides of the polygon, and the current brush to fill it. Windows CE fills all enclosed regions within the polygon with the current brush.
Note Windows CE does not support multiple fill modes. When it fills a polygon, it fills all subareas created by intersecting lines within the polygon. This manner of filling is equivalent to the Winding fill mode used on Windows-based desktop platforms.
A rectangle is a four-sided polygon whose opposing sides are parallel and equal in length, and whose interior angles are 90 degrees. Although you can use the Polygon function to draw a rectangle if you supply it with all four sides, it is easier to use the Rectangle function. This function requires only the coordinates of the upper left and the lower right corners.
You can use the RoundRect function to draw a rectangle with rounded corners. Supply this function with the coordinates of the lower-left and upper-right corners of the rectangle, and the width and height of the ellipse used to round each corner.
You can use the FillRect function to paint the interior of a rectangle. You can use the FillRgn function to fill a region using the specified brush.
Because Windows CE does not support paths, many line drawing functions that are available in the Windows-based desktop platforms are not available in Windows CE. Windows CE does not support functions to draw a arc, beizer curve, chord, pie, polypolygon, or polypolyline. However, you can approximate these shapes using existing Windows CE drawing functions. For example, you can create an arc using the Ellipse function with an appropriately defined clipping region.
Note The Ellipse and RoundRect functions require a lot of GDI computation. To increase your application's performance, use these functions sparingly.