Beispiel #1
0
        internal static TextFormatFlags CreateTextFormatFlags(
            Control ctl,
            System.Drawing.ContentAlignment textAlign,
            bool showEllipsis,
            bool useMnemonic,
            bool showKeyboardCues)
        {
            textAlign = RtlTranslateContent(textAlign, ctl.RightToLeft);
            TextFormatFlags textFormatFlags = WindowFormsUtils.TextFormatFlagsForAlignmentGDI(textAlign) | TextFormatFlags.TextBoxControl | TextFormatFlags.WordBreak;

            if (showEllipsis)
            {
                textFormatFlags |= TextFormatFlags.EndEllipsis;
            }
            if (ctl.RightToLeft == RightToLeft.Yes)
            {
                textFormatFlags |= TextFormatFlags.RightToLeft;
            }
            if (!useMnemonic)
            {
                textFormatFlags |= TextFormatFlags.NoPrefix;
            }
            else if (!showKeyboardCues)
            {
                textFormatFlags |= TextFormatFlags.HidePrefix;
            }
            return(textFormatFlags);
        }
Beispiel #2
0
 internal static TextFormatFlags TextFormatFlagsForAlignmentGDI(
     System.Drawing.ContentAlignment align)
 {
     return(TextFormatFlags.Default | WindowFormsUtils.TranslateAlignmentForGDI(align) | WindowFormsUtils.TranslateLineAlignmentForGDI(align));
 }