Drawing Three-Dimensional Shapes and Text

You can draw a variety of three-dimensional shapes and text objects in the LEAD control's client area or directly on the bitmap. Possible shapes are stars, rectangles, triangles, and so forth. For a complete list, refer to the DrawShape method. The text objects can be rotated to any angle, specified in tenths of degrees.

For shapes and text:

The following property determines whether the shape or text object is drawn to the control's client area or to the bitmap:

DrawPersistence property

The following properties specify the color and offsets that apply a drop shadow to the shape or text object:

ShadowColor property

ShadowXDepth property

ShadowYDepth property

To turn off the shadow, set the X and Y depths to 0.

With text objects, the drop shadow is disabled with some styles, as shown in the following examples: Style with a Shadow and Style without a Shadow.

For shapes only:

Use the following method (with related properties) to draw a specified shape.

DrawShape method

The following properties specify the position and size of the shape:

ShapeLeft property

ShapeTop property

ShapeWidth property

ShapeHeight property

The following property specifies the background style of the shape:

ShapeBackgroundStyle property

For foreground patterns and colors, use the pattern properties described in to Gradients and Patterns. The following example shows how a fill pattern can be implemented: Shape with a Fill Pattern and Drop Shadow.

If the shape uses an image as its background, the following properties specify the source rectangle that defines which part of the bitmap to use for the background:

BackgroundImageHeight property

BackgroundImageLeft property

BackgroundImageTop property

BackgroundImageWidth property

The following properties specify the primary lines of the shape:

ShapeBorderColor property

ShapeBorderStyle property

ShapeBorderThickness property

The following properties specify the inner and outer bands that give the lines of the shape a three-dimensional appearance:

ShapeInnerBandHiliteColor property

ShapeInnerBandShadowColor property

ShapeInnerBandStyle property

ShapeInnerBandThickness property

ShapeOuterBandHiliteColor property

ShapeOuterBandShadowColor property

ShapeOuterBandStyle property

ShapeOuterBandThickness property

Inner bands apply only to rectangles and squares (not other shapes). The three-dimensional effects are most effective when you specify the inner band or outer band (but not both), as shown in the following examples: Inner band raised, Inner band inset, Outer band raised, and Outer band inset.

For text only:

Use the following method (with related properties) to draw a text object:

DrawText method

DrawTextOut method (limited support for related properties)

You can create an image that consists of a pattern or gradient color to use as a foreground of the text. Refer to Gradients and Patterns for related properties.

The following properties specify the bounding rectangle for the text object and the alignment of the text object in the rectangle:

TextLeft property

TextTop property

TextWidth property

TextHeight property

TextAlign property

The following properties specify the font and style of the text object:

Font property

DrawFontColor property

TextStyle property

TextWordWrap property

TextAngle property

TextHiliteColor property

Use the following methods to get the width and height that are required for a specified text string using the current property settings for text objects:

DrawTextHeight method

DrawTextWidth method

These methods measure a single line of text (rotated or unrotated). They disregard the TextWordWrap property.