ArcObjects Library Reference (System)  

IFractionFormat.FractionOption Property

The fraction option determines how the numerator and denominator of the fraction are treated.

[Visual Basic .NET]
Public Property FractionOption As esriFractionOptionEnum
[C#]
public esriFractionOptionEnum FractionOption {get; set;}
[C++]
HRESULT get_FractionOption(
  esriFractionOptionEnum* option
);
[C++]
HRESULT put_FractionOption(
  esriFractionOptionEnum option
);
[C++]

Parameters

option [out, retval]

  option is a parameter of type esriFractionOptionEnum

option [in]

  option is a parameter of type esriFractionOptionEnum

Product Availability

Available with ArcGIS Engine, ArcGIS Desktop, and ArcGIS Server.

Description

The FractionOption property sets or returns an option that determines how the FractionFactor property is used when the ValueToString method in the associated INumberFormat interface formats numbers.

The settings for FractionOption are:

Setting Description

esriSpecifyFractionDigits

(Default) The FractionFactor property specifies the maximum number of digits the numerator or denominator is calculated to.

If the value passed to ValueToString evaluates to a fraction whose numerator or denominator has more digits than specified in the FractionFactor property, the formatted string will be the closest fraction to the number of digits specified. In the example, StringToValue first evaluates the fraction 893/1234 to return a decimal value of 0.723662884927066. ValueToString can format this decimal number back to 893/1234; however, the maximum number of decimal places to be used in the output fraction is three (by default). Therefore, by default this returns a formatted result of 474/655 because this is the closest three-digit fraction to the decimal value. To calculate all four digits in the denominator and return to the original fraction, FractionFactor needs to be set to a value of 4. The caveat here is that the higher the FractionFactor setting, the more processing time it will take to figure out the fraction.

esriSpecifyFractionDenominator

The FractionFactor property value explicitly specifies the denominator. Since the ValueToString method doesn't have to calculate the denominator, the result is returned very quickly.

 

Remarks

For example, when using esriSpecifyFractionDenominator, if the FractionFactor is set to 8, then the resulting fraction would be given in eighths. The result will be rounded to fit the denominator specified, as both 0.75 and 0.85 become 3/4 in the example below.

When using StringToValue, neither the FractionOption nor the FractionFactor properties are used; instead, a straightforward evaluation of the fraction is carried out. For example, 5/8 returns a value of 0.625, and 6 3/4 returns 6.75.

See Also

IFractionFormat Interface | IScientificNumberFormat Interface | PercentageFormat Class | INumberFormat Interface | INumericFormat Interface | FractionFormat Class | IPercentageFormat Interface | ILatLonFormat Interface | ILatLonFormat2 Interface | LatLonFormat Class | ICustomNumberFormat Interface | RateFormat Class | NumericFormat Class | ScientificFormat Class | IRateFormat Interface | AngleFormat Class | IFractionFormat Interface | CurrencyFormat Class | CustomNumberFormat Class | IAngleFormat Interface