External/Aga.Controls/TextHelper.cs
changeset 345 0c551e8818e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/External/Aga.Controls/TextHelper.cs	Sun May 27 15:16:19 2012 +0000
     1.3 @@ -0,0 +1,45 @@
     1.4 +using System;
     1.5 +using System.Collections.Generic;
     1.6 +using System.Text;
     1.7 +using System.Windows.Forms;
     1.8 +using System.Drawing;
     1.9 +
    1.10 +namespace Aga.Controls
    1.11 +{
    1.12 +	public static class TextHelper
    1.13 +	{
    1.14 +		public static StringAlignment TranslateAligment(HorizontalAlignment alignment)
    1.15 +		{
    1.16 +			if (alignment == HorizontalAlignment.Left)
    1.17 +				return StringAlignment.Near;
    1.18 +			else if (alignment == HorizontalAlignment.Right)
    1.19 +				return StringAlignment.Far;
    1.20 +			else
    1.21 +				return StringAlignment.Center;
    1.22 +		}
    1.23 +
    1.24 +        public static TextFormatFlags TranslateAligmentToFlag(HorizontalAlignment alignment)
    1.25 +        {
    1.26 +            if (alignment == HorizontalAlignment.Left)
    1.27 +                return TextFormatFlags.Left;
    1.28 +            else if (alignment == HorizontalAlignment.Right)
    1.29 +                return TextFormatFlags.Right;
    1.30 +            else
    1.31 +                return TextFormatFlags.HorizontalCenter;
    1.32 +        }
    1.33 +
    1.34 +		public static TextFormatFlags TranslateTrimmingToFlag(StringTrimming trimming)
    1.35 +		{
    1.36 +			if (trimming == StringTrimming.EllipsisCharacter)
    1.37 +				return TextFormatFlags.EndEllipsis;
    1.38 +			else if (trimming == StringTrimming.EllipsisPath)
    1.39 +				return TextFormatFlags.PathEllipsis;
    1.40 +			if (trimming == StringTrimming.EllipsisWord)
    1.41 +				return TextFormatFlags.WordEllipsis;
    1.42 +			if (trimming == StringTrimming.Word)
    1.43 +				return TextFormatFlags.WordBreak;
    1.44 +			else
    1.45 +				return TextFormatFlags.Default;
    1.46 +		}
    1.47 +	}
    1.48 +}