コード例 #1
0
        /// <summary>
        /// Converts a value (unit: points) in a given unit and returns it as text together with the unit.
        /// </summary>
        /// <param name="value">Value of length in points.</param>
        /// <param name="lastUnit">The unit to convert to.</param>
        /// <returns>A text string: the value together with the unit.</returns>
        public static string GetLengthMeasureText(double value, LengthUnit lastUnit)
        {
            double v = lastUnit.ConvertFrom(value, LengthUnit.Point);

            return(GUIConversion.ToString(v, "G5") + " " + lastUnit.Shortcut);
        }
コード例 #2
0
 /// <summary>
 /// Converts a value (0 to 1) in percents (i.e. 0 to 100) and returns it as text together with the percent char.
 /// </summary>
 /// <param name="value">Value (0..1)</param>
 /// <returns>A text string: the value together with the unit.</returns>
 public static string GetPercentMeasureText(double value)
 {
     return(GUIConversion.ToString(value * 100, "G5") + " %");
 }