Beispiel #1
0
        internal virtual TextFormatFlags CreateTextFormatFlags(Size constrainingSize)
        {
            TextFormatFlags flags = ControlPaint.CreateTextFormatFlags(this, this.TextAlign, this.AutoEllipsis, this.UseMnemonic);

            if (!this.MeasureTextCache.TextRequiresWordBreak(this.Text, this.Font, constrainingSize, flags))
            {
                flags &= ~(TextFormatFlags.TextBoxControl | TextFormatFlags.WordBreak);
            }
            return(flags);
        }
Beispiel #2
0
        // For compatibility with WinForms (for use with Reflection)
        internal virtual TextFormatFlags CreateTextFormatFlags(Size constrainingSize)
        {
            TextFormatFlags flags = ControlPaint.CreateTextFormatFlags(this, this.TextAlign, this.AutoEllipsis, this.UseMnemonic);

            // FIXME:
            // Remove WordBreak if the size is large enough to display all the text.
            //if (!MeasureTextCache.TextRequiresWordBreak(Text, Font, constrainingSize, flags))
            {
                // 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);
            }

            return(flags);
        }