Rectangle

The Rectangle element is another common geometric shape that you can utilize in custom control templates. Drawing a rectangle is easy, as demonstrated in the following code example:

image

You simply define its dimensions, specifying Stroke and StrokeThickness as for the ellipse (optional). Figure 32.16 shows how the object is drawn.

Figure 32.16 Drawing a rectangle.

image

Rectangle also has the RadiusX and RadiusY properties that you can assign to round corners.

Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.