internal static TextFormatFlags CreateTextFormatFlags(Control ctl, ContentAlignment textAlign, bool showEllipsis, bool useMnemonic) { //textAlign = ctl.RtlTranslateContent(textAlign); TextFormatFlags flags = ControlPaint.TextFormatFlagsForAlignmentGDI(textAlign); // The effect of the TextBoxControl flag is that in-word line breaking will occur if needed, this happens when AutoSize // is false and a one-word line still doesn't fit the binding box (width). The other effect is that partially visible // lines are clipped; this is how GDI+ works by default. flags |= TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl; if (showEllipsis) { flags |= TextFormatFlags.EndEllipsis; } // Adjust string format for Rtl controls if (ctl.RightToLeft == RightToLeft.Yes) { flags |= TextFormatFlags.RightToLeft; } //if we don't use mnemonic, set formatFlag to NoPrefix as this will show the ampersand if (!useMnemonic) { flags |= TextFormatFlags.NoPrefix; } //else if we don't show keyboard cues, set formatFlag to HidePrefix as this will hide //the ampersand if we don't press down the alt key else if (!ctl.ShowKeyboardCues) { flags |= TextFormatFlags.HidePrefix; } return(flags); }