LEADTOOLS Annotations (Leadtools.Annotations assembly) Send comments on this topic. | Back to Introduction - All Topics | Help Version 17.0.3.29
SetUnitAbbreviation Method
See Also 
Leadtools.Annotations Namespace > AnnUnitConverter Class : SetUnitAbbreviation Method



unit
An AnnUnit value to change its abbreviation.
newValue
A string value that specifies the abbreviation to be used with unit.
unit
An AnnUnit value to change its abbreviation.
newValue
A string value that specifies the abbreviation to be used with unit.
Modifies the default string abbreviation to be used with a specific unit.

Syntax

Visual Basic (Declaration) 
Public Shared Function SetUnitAbbreviation( _
   ByVal unit As AnnUnit, _
   ByVal newValue As String _
) As String
Visual Basic (Usage)Copy Code
Dim unit As AnnUnit
Dim newValue As String
Dim value As String
 
value = AnnUnitConverter.SetUnitAbbreviation(unit, newValue)
C# 
public static string SetUnitAbbreviation( 
   AnnUnit unit,
   string newValue
)
C++/CLI 
public:
static String^ SetUnitAbbreviation( 
   AnnUnit unit,
   String^ newValue
) 

Parameters

unit
An AnnUnit value to change its abbreviation.
newValue
A string value that specifies the abbreviation to be used with unit.

Return Value

A System.String that specifes the previous default value.

Example

This example will change the abbreviation of SmartEnglish from the default of "in" to "inch":

Visual BasicCopy Code
Private Sub AnnUnitConverter_SetUnitAbbreviation()
   Dim ruler1 As New AnnRulerObject()
   ruler1.MeasurementUnit = AnnUnit.SmartEnglish
   ' Should be the default of "in"
   Console.WriteLine("UnitAbbreviation: {0}", ruler1.UnitAbbreviation)
   ' Change the default abbreviation of SmartEnglish to "inches"
   AnnUnitConverter.SetUnitAbbreviation(AnnUnit.SmartEnglish, "inches")

   ' Create another ruler with SmartEnglish measurement units
   Dim ruler2 As New AnnRulerObject()
   ruler2.MeasurementUnit = AnnUnit.SmartEnglish
   ' Should be the new value of "inches"
   Console.WriteLine("UnitAbbreviation: {0}", ruler2.UnitAbbreviation)
End Sub
C#Copy Code
private void AnnUnitConverter_SetUnitAbbreviation()
{
   AnnRulerObject ruler1 = new AnnRulerObject();
   ruler1.MeasurementUnit = AnnUnit.SmartEnglish;
   // Should be the default of "in"
   Console.WriteLine("UnitAbbreviation: {0}", ruler1.UnitAbbreviation);
   // Change the default abbreviation of SmartEnglish to "inches"
   AnnUnitConverter.SetUnitAbbreviation(AnnUnit.SmartEnglish, "inches");

   // Create another ruler with SmartEnglish measurement units
   AnnRulerObject ruler2 = new AnnRulerObject();
   ruler2.MeasurementUnit = AnnUnit.SmartEnglish;
   // Should be the new value of "inches"
   Console.WriteLine("UnitAbbreviation: {0}", ruler2.UnitAbbreviation);
}

Remarks

You can use this method to globally change the abbreviation used with any unit during the life of your program.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 2000, Windows XP, Windows Server 2003 family, Windows Server 2008 family, Windows Vista, Windows 7

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Imaging Pro/Document/Medical Features