Esempio n. 1
0
        private StringFormat CreateStringFormat()
        {
            StringFormat stringFormat = ControlPaint.StringFormatForAlignment(TextAlign);

            // Adjust string format for Rtl controls
            if (RightToLeft == RightToLeft.Yes)
            {
                stringFormat.FormatFlags |= StringFormatFlags.DirectionRightToLeft;
            }

            if (!UseMnemonic)
            {
                stringFormat.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None;
            }
            else if (ShowKeyboardCues)
            {
                stringFormat.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Show;
            }
            else
            {
                stringFormat.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.Hide;
            }
            if (AutoSize)
            {
                stringFormat.FormatFlags |= StringFormatFlags.MeasureTrailingSpaces;
            }

            return(stringFormat);
        }