IMSL C# Programmer’s Guide
2D Drawing Elements >> Text Attributes  Previous Page  Contents  Next Page

Text Attributes

Attribute Font

Text is drawn using Font objects constructed using the FontName, FontSize and FontStyle attributes. The ChartNode.Font property does not save the Font object, but sets these three attributes.

This arrangement allows one to specify font size and style at lower nodes and change the font face at the root node.

Multiline text strings are allowed. They are created by newline characters in the string that creates the text item.

Attribute FontName

FontName is a string-valued attribute that specifies the logical font name or a font face name.

Attribute FontSize

FontSize is an integer-valued attribute that specifies the point size of the font. Its default value is 8.

Attribute FontStyle

FontStyle is a System.Drawing. FontStyle-valued attribute that specifies the font style. This can be a bitwise combination of any of the standard types in the Font-Style enum. Its default value is FontStyle.Regular.

Attribute TextAngle

TextAngle is an integer-valued attribute that specifies the angle, in degrees, at which text is drawn. The angle is measured counterclockwise. Its default value is 0.

Attribute TextColor

TextColor is a Color-valued attribute that specifies the color in which the text is drawn. Its default value is Color.Black.

Attribute TextFormat

TextFormat is a string-valued attribute that specifies how to format string objects. The .NET Framework provides a wide variety of formatting options and conven- ient standard format specifiers.

For numeric values, specifiers like “C” for Currency, "E" for scientific exponen- tial, and “P” for Percentage are available. DateTime objects can use "d" for a Short date pattern or “D” for a Long date pattern and many others. Custom Numeric Format Strings can be created using "0" for a zero placeholder, "#" for a digit placeholder and others. The default value is "0.00"

Attribute TextFormatProvider

TextFormatProvider is a IFormatProvider-valued attribute that supplies culture-specific formatting information. The default value is null so the default Culture-Info, DateTimeFormatInfo and NumberFormatInfo are utilized.

Attribute Title

Title is a Text-valued or string-valued attribute that contains the title for a node. The class Text holds a string and its alignment and offset information.

The alignment of a Text object is the bitwise combination of one of

The offset moves the start of the text away from the reference point in the direction of the alignment. So if the alignment bit TEXT_X_LEFT is set and the offset is greater than zero then the text starts a distance further to the left than if the offset were zero. The distance moved is the value of offset times the default marker size. The offset is usually zero, but the Data node sets it to 2.0 for labeling data points.

A Text object is drawn relative to a reference point. The alignment specifies the position of the reference point on the box that contains the text. There are nine such possible positions. In the following samples, the reference point is marked with a square

If the text is drawn at an angle, then the alignment is relative to the horizontally/ vertically aligned bounding box of the text.



©  Visual Numerics, Inc.  All rights reserved.  Previous Page  Contents  Next Page