Dundas Chart for Windows Forms
Format Property
See Also  Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > Label Class : Format Property


A value that determines a formatting expression.


Label text format

Syntax

Visual Basic (Declaration)  
Public Property Format As String
Visual Basic (Usage) Copy Code
Dim instance As Label
Dim value As String
 
instance.Format = value
 
value = instance.Format
C#  
public string Format {get; set;}

Return Value

A string that determines a formatting expression. Defaults to a zero-length string.

Remarks

Formatting can be performed at design-time using the "Label Format" editor, which is accessed using a "Format" property in the designer. It can also be done at run-time using code.

There are three possible types of label formats: numerical, date/time and custom.

Numerical formats are: Currency, Decimal, Scientific, Fixed-Point, General, Number and Percent. The precision-specifier determines the desired number of decimal places. Refer to the Numeric Format Strings topic in the MSDN library for further details.

There are numerous standard date/time formats (e.g. Short Date, Long Date, Short Time, Long Time, etc.). For a complete listing see the Date and Time Format Strings topic in your MSDN library, and refer to the "Standard DateTime Format Strings" section.

For DateTime formatting to have an effect the object that the format is being applied to must be of type DateTime. For example, if Axis.LabelStyle.Format is a DateTime formatting expression then the axis labels must be DateTime expressions, which is accomplished by generating axis labels from DateTime X-values of data points (set by the XAxisType property).

Custom formatting can be one of two types: Numerical or Date/Time, and specific characters are used to create a mask that is then applied to the labels. See the Formatting Types topic in your MSDN library for a detailed discussion concerning custom formatting.

For sample code illustrating how to implement custom and standard formatting at run-time see the Date and Time Format Strings topic in the MSDN library.

See the Label Styles and Formats topic for a detailed discussion on label formatting.

In Dundas Chart, the "P" and "%" format string functionality is override. The reason for this is the need for the exact numbers to be loaded into the Chart, being the numbers used on the axis and point labels. This applies to the "P" format string (seen in "Standard Numeric Format Strings" on MSDN) and the "%" character (described in "Custom Numeric Format Strings").

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

© 2009 All Rights Reserved.