Leadtools.Annotations Namespace > AnnUnitConverter Class : SetUnitAbbreviation Method |
'Declaration Public Shared Function SetUnitAbbreviation( _ ByVal unit As AnnUnit, _ ByVal newValue As String _ ) As String
'Usage Dim unit As AnnUnit Dim newValue As String Dim value As String value = AnnUnitConverter.SetUnitAbbreviation(unit, newValue)
You can use this method to globally change the abbreviation used with any unit during the life of your program.
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
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); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2