760 references to TextFormatFlags
System.Windows.Forms (371)
System\Windows\Forms\Controls\Buttons\ButtonBase.cs (2)
1023internal virtual TextFormatFlags CreateTextFormatFlags() 1028return TextFormatFlags.Default;
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (3)
92/// Get <see cref="TextFormatFlags"/> for rendering text using GDI (<see cref="TextRenderer"/>). 94internal virtual TextFormatFlags CreateTextFormatFlags() 490TextFormatFlags formatFlags = CreateTextFormatFlags();
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (5)
50public TextFormatFlags GdiTextFormatFlags { get; set; } = TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl; 100public TextFormatFlags TextFormatFlags => 101_disableWordWrapping ? GdiTextFormatFlags & ~TextFormatFlags.WordBreak : GdiTextFormatFlags;
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (15)
65/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 124/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 128/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 136TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 141/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 142public static void DrawButton(Graphics g, Rectangle bounds, string? buttonText, Font? font, TextFormatFlags flags, bool focused, PushButtonState state) 170/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 197/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, PushButtonState)"/> 211TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 225TextFormatFlags flags, 237TextFormatFlags flags,
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (13)
49/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/> 83/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/> 97TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 101/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/> 108TextFormatFlags flags, 118TextFormatFlags flags, 155/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, CheckBoxState)"/> 171TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 186TextFormatFlags flags,
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (14)
49/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" /> 87/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" /> 98TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 102/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" /> 109TextFormatFlags flags, 122TextFormatFlags flags, 155/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?, TextFormatFlags, Image, Rectangle, bool, RadioButtonState)" /> 171TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 186TextFormatFlags flags, 209TextFormatFlags flags,
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (2)
774Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)), TextFormatFlags.SingleLine); 785Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)), TextFormatFlags.SingleLine);
System\Windows\Forms\Controls\ComboBox\ComboBoxRenderer.cs (4)
60DrawTextBox(g, bounds, comboBoxText, font, TextFormatFlags.TextBoxControl, state); 68DrawTextBox(g, bounds, comboBoxText, font, textBounds, TextFormatFlags.TextBoxControl, state); 74public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, TextFormatFlags flags, ComboBoxState state) 86public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font, Rectangle textBounds, TextFormatFlags flags, ComboBoxState state)
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (2)
304TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 987TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (15)
19private const TextFormatFlags TextFormatSupportedFlags = TextFormatFlags.SingleLine 20| /*TextFormatFlags.NoFullWidthCharacterBreak |*/ TextFormatFlags.WordBreak | TextFormatFlags.NoPrefix; 2321TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(rightToLeft, cellStyle.Alignment, cellStyle.WrapMode); 2524TextFormatFlags flags) => MeasureTextHeight( 2538TextFormatFlags flags, 2547throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(TextFormatFlags)); 2563TextFormatFlags flags) 2571throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(TextFormatFlags)); 2608TextFormatFlags flags) 2615throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(TextFormatFlags)); 2629TextFormatFlags flags) 2634if (oneLineSize.Height >= maxHeight || (flags & TextFormatFlags.SingleLine) != 0) 3954internal static bool TextFitsInBounds(Graphics graphics, string text, Font font, Size maxBounds, TextFormatFlags flags)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (4)
500TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 966TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 971if ((flags & TextFormatFlags.SingleLine) != 0) 973flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (5)
831return MeasureTextHeight(graphics, " ", cellStyle.Font!, int.MaxValue, TextFormatFlags.Default) + adjustment; 1180TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 2319TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 2324if ((flags & TextFormatFlags.SingleLine) != 0) 2326flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (4)
561TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 959TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment( 1022if ((flags & TextFormatFlags.SingleLine) != 0) 1024flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (4)
533TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 847TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 883if ((flags & TextFormatFlags.SingleLine) != 0) 885flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (5)
224TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 413TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 729TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment( 738if ((flags & TextFormatFlags.SingleLine) != 0) 740flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (4)
148TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 318TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 323if ((flags & TextFormatFlags.SingleLine) != 0) 325flags |= TextFormatFlags.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewUtilities.cs (66)
36internal static TextFormatFlags ComputeTextFormatFlagsForCellStyleAlignment( 41TextFormatFlags tff; 45tff = TextFormatFlags.Top; 48tff |= TextFormatFlags.Right; 52tff |= TextFormatFlags.Left; 57tff = TextFormatFlags.Top | TextFormatFlags.HorizontalCenter; 60tff = TextFormatFlags.Top; 63tff |= TextFormatFlags.Left; 67tff |= TextFormatFlags.Right; 72tff = TextFormatFlags.VerticalCenter; 75tff |= TextFormatFlags.Right; 79tff |= TextFormatFlags.Left; 84tff = TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter; 87tff = TextFormatFlags.VerticalCenter; 90tff |= TextFormatFlags.Left; 94tff |= TextFormatFlags.Right; 99tff = TextFormatFlags.Bottom; 102tff |= TextFormatFlags.Right; 106tff |= TextFormatFlags.Left; 111tff = TextFormatFlags.Bottom | TextFormatFlags.HorizontalCenter; 114tff = TextFormatFlags.Bottom; 117tff |= TextFormatFlags.Left; 121tff |= TextFormatFlags.Right; 126tff = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter; 132tff |= TextFormatFlags.SingleLine; 137tff |= TextFormatFlags.WordBreak; 140tff |= TextFormatFlags.NoPrefix; 141tff |= TextFormatFlags.PreserveGraphicsClipping; 144tff |= TextFormatFlags.RightToLeft; 159TextFormatFlags flags) 307TextFormatFlags flags, 316TextFormatFlags flags, 320if ((flags & TextFormatFlags.SingleLine) != 0) 325flags |= TextFormatFlags.EndEllipsis; 352TextFormatFlags flags, 359if ((flags & TextFormatFlags.RightToLeft) != 0) 444internal static bool ValidTextFormatFlags(TextFormatFlags flags) 447return (flags & ~(TextFormatFlags.Bottom | 448TextFormatFlags.Default | 449TextFormatFlags.EndEllipsis | 450TextFormatFlags.ExpandTabs | 451TextFormatFlags.ExternalLeading | 452TextFormatFlags.HidePrefix | 453TextFormatFlags.HorizontalCenter | 454TextFormatFlags.Internal | 455TextFormatFlags.Left | 456TextFormatFlags.ModifyString | 457TextFormatFlags.NoClipping | 458TextFormatFlags.NoFullWidthCharacterBreak | 459TextFormatFlags.NoPrefix | 460TextFormatFlags.PathEllipsis | 461TextFormatFlags.PrefixOnly | 462TextFormatFlags.PreserveGraphicsClipping | 463TextFormatFlags.PreserveGraphicsTranslateTransform | 464TextFormatFlags.Right | 465TextFormatFlags.RightToLeft | 466TextFormatFlags.SingleLine | 467TextFormatFlags.TextBoxControl | 468TextFormatFlags.Top | 469TextFormatFlags.VerticalCenter | 470TextFormatFlags.WordBreak | 471TextFormatFlags.WordEllipsis)) == 0;
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (11)
411TextFormatFlags textFlags = TextFormatFlags.TextBoxControl | TextFormatFlags.WordBreak 412| TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping; 416textFlags |= TextFormatFlags.HidePrefix; 421textFlags |= (TextFormatFlags.Right | TextFormatFlags.RightToLeft); 515textSize = hdc.HDC.MeasureText(Text, hfont, new Size(textRectangle.Width, int.MaxValue), (TextFormatFlags)flags); 519hdc.HDC.DrawText(Text, hfont, textRectangle, ForeColor, (TextFormatFlags)flags); 529(TextFormatFlags)flags);
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (16)
78=> DrawGroupBox(g, bounds, groupBoxText, font, TextFormatFlags.Top | TextFormatFlags.Left, state); 90=> DrawGroupBox(g, bounds, groupBoxText, font, textColor, TextFormatFlags.Top | TextFormatFlags.Left, state); 100TextFormatFlags flags, 109TextFormatFlags flags, 131TextFormatFlags flags, 141TextFormatFlags flags, 172TextFormatFlags flags, 191if ((flags & TextFormatFlags.Right) == TextFormatFlags.Right) 219if ((flags & TextFormatFlags.Right) == TextFormatFlags.Right) 278TextFormatFlags flags) 294if ((flags & TextFormatFlags.Right) == TextFormatFlags.Right)
System\Windows\Forms\Controls\Labels\Label.cs (13)
913private TextFormatFlags CreateTextFormatFlags() 919private protected TextFormatFlags CreateTextFormatFlags(Size constrainingSize) 926TextFormatFlags flags = ControlPaint.CreateTextFormatFlags(this, TextAlign, AutoEllipsis, UseMnemonic); 934flags &= ~(TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl); 1074TextFormatFlags format = FlatStyle == FlatStyle.System ? TextFormatFlags.Default : CreateTextFormatFlags(proposedConstraints); 1111TextFormatFlags flags = CreateTextFormatFlags(); 1114if ((flags & TextFormatFlags.NoPadding) == TextFormatFlags.NoPadding) 1118else if ((flags & TextFormatFlags.LeftAndRightPadding) == TextFormatFlags.LeftAndRightPadding) 1295TextFormatFlags flags = CreateTextFormatFlags();
System\Windows\Forms\Controls\Labels\LinkLabel.cs (5)
558TextFormatFlags flags = CreateTextFormatFlags(clientSize); 565if ((flags & TextFormatFlags.NoPadding) == TextFormatFlags.NoPadding) 569else if ((flags & TextFormatFlags.LeftAndRightPadding) == TextFormatFlags.LeftAndRightPadding)
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (6)
686TextFormatFlags flags = TextFormatFlags.Default; 687flags |= TextFormatFlags.NoPrefix; 691flags |= TextFormatFlags.ExpandTabs; 697flags |= TextFormatFlags.RightToLeft; 698flags |= TextFormatFlags.Right;
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (6)
128TextFormatFlags flags = (hAlign == HorizontalAlignment.Left) ? TextFormatFlags.Left : 129((hAlign == HorizontalAlignment.Center) ? TextFormatFlags.HorizontalCenter : 130TextFormatFlags.Right); 131flags |= TextFormatFlags.WordEllipsis; 139public void DrawText(TextFormatFlags flags)
System\Windows\Forms\Controls\ListView\DrawListViewItemEventArgs.cs (2)
84public void DrawText() => DrawText(TextFormatFlags.Left); 89public void DrawText(TextFormatFlags flags)
System\Windows\Forms\Controls\ListView\DrawListViewSubItemEventArgs.cs (6)
124TextFormatFlags flags = (hAlign == HorizontalAlignment.Left) ? TextFormatFlags.Left : 125((hAlign == HorizontalAlignment.Center) ? TextFormatFlags.HorizontalCenter : 126TextFormatFlags.Right); 127flags |= TextFormatFlags.WordEllipsis; 135public void DrawText(TextFormatFlags flags)
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.MeasureTextHelper.cs (10)
29TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform); 39TextFormatFlags.PreserveGraphicsClipping 40| TextFormatFlags.PreserveGraphicsTranslateTransform 41| TextFormatFlags.LeftAndRightPadding 42| TextFormatFlags.WordBreak 43| TextFormatFlags.NoFullWidthCharacterBreak); 45public static TextFormatFlags GetTextRendererFlags() 46=> TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform;
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (1)
1944(TextFormatFlags)format | PropertyGrid.MeasureTextHelper.GetTextRendererFlags());
System\Windows\Forms\Controls\TabControl\TabRenderer.cs (8)
65TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 72public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, TextFormatFlags flags, bool focused, TabItemState state) 114TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.SingleLine, 121public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font, TextFormatFlags flags, Image image, Rectangle imageRectangle, bool focused, TabItemState state)
System\Windows\Forms\Controls\TextBox\TextBox.cs (12)
868TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.Top | TextFormatFlags.EndEllipsis; 873flags |= TextFormatFlags.RightToLeft; 877flags |= TextFormatFlags.HorizontalCenter; 881flags |= TextFormatFlags.Right; 885flags |= TextFormatFlags.Left; 892flags &= ~TextFormatFlags.RightToLeft; 896flags |= TextFormatFlags.HorizontalCenter; 900flags |= TextFormatFlags.Left; 904flags |= TextFormatFlags.Right;
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (4)
840TextFormatFlags format = TextFormatFlags.NoPrefix; 843format |= TextFormatFlags.SingleLine; 847format |= TextFormatFlags.WordBreak;
System\Windows\Forms\Controls\TextBox\TextBoxRenderer.cs (4)
53DrawTextBox(g, bounds, textBoxText, font, TextFormatFlags.TextBoxControl, state); 61DrawTextBox(g, bounds, textBoxText, font, textBounds, TextFormatFlags.TextBoxControl, state); 67public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, TextFormatFlags flags, TextBoxState state) 78public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font, Rectangle textBounds, TextFormatFlags flags, TextBoxState state)
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.ToolStripItemInternalLayout.cs (6)
69public virtual TextFormatFlags TextFormat 82internal static TextFormatFlags ContentAlignmentToTextFormat(ContentAlignment alignment, bool rightToLeft) 84TextFormatFlags textFormat = TextFormatFlags.Default; 88textFormat |= TextFormatFlags.RightToLeft; 129layoutOptions.GdiTextFormatFlags = Owner.ShowKeyboardCues ? layoutOptions.GdiTextFormatFlags : layoutOptions.GdiTextFormatFlags | TextFormatFlags.HidePrefix;
System\Windows\Forms\Controls\ToolStrips\ToolStripItemTextRenderEventArgs.cs (3)
26TextFormatFlags format) 59TextFormat = (item.ShowKeyboardCues) ? TextFormat : TextFormat | TextFormatFlags.HidePrefix; 96public TextFormatFlags TextFormat { get; set; }
System\Windows\Forms\Controls\ToolStrips\ToolStripRenderer.cs (1)
870TextFormatFlags textFormat = e.TextFormat;
System\Windows\Forms\Controls\TreeView\TreeView.cs (2)
2848TextRenderer.DrawText(g, node.Text, font, bounds, color, TextFormatFlags.Default); 2855TextRenderer.DrawText(g, node.Text, font, bounds, color, TextFormatFlags.Default);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
205textSize = Size.Ceiling(TextRenderer.MeasureText(messageText, Font, textSize, TextFormatFlags.WordBreak));
System\Windows\Forms\Layout\LayoutUtils.cs (1)
50Size textSize = TextRenderer.MeasureText(obj.ToString(), font, new Size(short.MaxValue, short.MaxValue), TextFormatFlags.SingleLine);
System\Windows\Forms\Layout\LayoutUtils.MeasureTextCache.cs (4)
29public Size GetTextSize(string? text, Font? font, Size proposedConstraints, TextFormatFlags flags) 99public bool TextRequiresWordBreak(string? text, Font? font, Size size, TextFormatFlags flags) 108private Size GetUnconstrainedSize(string? text, Font? font, TextFormatFlags flags) 115flags &= ~TextFormatFlags.WordBreak; // rip out the wordbreak flag
System\Windows\Forms\Rendering\ControlPaint.cs (18)
1982TextFormatFlags format) 1999TextFormatFlags format, 2503internal static TextFormatFlags ConvertAlignmentToTextFormat(ContentAlignment alignment) 2506TextFormatFlags flags = TextFormatFlags.Top | TextFormatFlags.Left; 2510flags |= TextFormatFlags.Bottom; 2514flags |= TextFormatFlags.VerticalCenter; 2519flags |= TextFormatFlags.Right; 2523flags |= TextFormatFlags.HorizontalCenter; 2586internal static TextFormatFlags CreateTextFormatFlags( 2593TextFormatFlags flags = ConvertAlignmentToTextFormat(alignment); 2598flags |= TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl; 2602flags |= TextFormatFlags.EndEllipsis; 2608flags |= TextFormatFlags.RightToLeft; 2614flags |= TextFormatFlags.NoPrefix; 2619flags |= TextFormatFlags.HidePrefix;
System\Windows\Forms\Rendering\TextExtensions.cs (5)
25private static (DRAW_TEXT_FORMAT Flags, TextPaddingOptions Padding) SplitTextFormatFlags(TextFormatFlags flags) 35TextPaddingOptions padding = flags.HasFlag(TextFormatFlags.LeftAndRightPadding) 37: flags.HasFlag(TextFormatFlags.NoPadding) 55TextFormatFlags flags, 215TextFormatFlags flags)
System\Windows\Forms\Rendering\TextRenderer.cs (49)
18internal const TextFormatFlags SkipAssertFlag = (TextFormatFlags)0x4000_0000; 74TextFormatFlags flags) 86/// <param name="flags">A bitwise combination of the <see cref="TextFormatFlags"/> values.</param> 89/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 97TextFormatFlags flags) 114TextFormatFlags flags) 127/// <param name="flags">A bitwise combination of the <see cref="TextFormatFlags"/> values.</param> 130/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 139TextFormatFlags flags) 204TextFormatFlags flags) 216/// <param name="flags">A bitwise combination of the <see cref="TextFormatFlags"/> values.</param> 219/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 227TextFormatFlags flags) 244TextFormatFlags flags) 257/// <param name="flags">A bitwise combination of the <see cref="TextFormatFlags"/> values.</param> 260/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 269TextFormatFlags flags) 286TextFormatFlags flags = TextFormatFlags.Default) 296TextFormatFlags flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter) 318TextFormatFlags flags) 328TextFormatFlags flags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter) 352TextFormatFlags flags) 363TextFormatFlags flags) 369private static TextFormatFlags BlockModifyString(TextFormatFlags flags) 372if (flags.HasFlag(TextFormatFlags.ModifyString)) 392/// <see cref="DrawText(IDeviceContext, ReadOnlySpan{char}, Font?, Rectangle, Color, TextFormatFlags)"/> 393/// overloads that takes a <see cref="TextFormatFlags"/> parameter. For example, the default behavior of the 398/// <see cref="TextFormatFlags"/> parameter. For an example, see 399/// <see cref="MeasureText(IDeviceContext, string?, Font?, Size, TextFormatFlags)"/>. 421public static Size MeasureText(string? text, Font? font, Size proposedSize, TextFormatFlags flags) 437/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 439public static Size MeasureText(ReadOnlySpan<char> text, Font? font, Size proposedSize, TextFormatFlags flags) 483TextFormatFlags flags) 501/// Thrown if <see cref="TextFormatFlags.ModifyString"/> is set. 508TextFormatFlags flags) 515TextFormatFlags flags = TextFormatFlags.Bottom) 531TextFormatFlags flags = TextFormatFlags.Bottom) 602internal static ApplyGraphicsProperties GetApplyStateFlags(IDeviceContext deviceContext, TextFormatFlags textFormatFlags) 610if (textFormatFlags.HasFlag(TextFormatFlags.PreserveGraphicsClipping)) 615if (textFormatFlags.HasFlag(TextFormatFlags.PreserveGraphicsTranslateTransform))
System\Windows\Forms\ToolTip\DrawToolTipEventArgs.cs (5)
84DrawText(TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter 85| TextFormatFlags.SingleLine | TextFormatFlags.HidePrefix); 91public void DrawText(TextFormatFlags flags)
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (5)
365DrawText(dc, bounds, textToDraw, drawDisabled, TextFormatFlags.HorizontalCenter); 371public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags) 379internal void DrawText(HDC dc, Rectangle bounds, string? textToDraw, bool drawDisabled, TextFormatFlags flags) 658public unsafe Rectangle GetTextExtent(IDeviceContext dc, string textToDraw, TextFormatFlags flags) 681public unsafe Rectangle GetTextExtent(IDeviceContext dc, Rectangle bounds, string textToDraw, TextFormatFlags flags)
System.Windows.Forms.Design (13)
System\ComponentModel\Design\CollectionEditor.SplitButton.cs (5)
197TextFormatFlags formatFlags = TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter; 224formatFlags |= TextFormatFlags.NoPrefix; 228formatFlags |= TextFormatFlags.HidePrefix;
System\Windows\Forms\Design\DesignBindingPicker.cs (6)
1855TextFormatFlags formatFlags = 1856TextFormatFlags.WordBreak | 1857TextFormatFlags.EndEllipsis | 1858TextFormatFlags.TextBoxControl | 1859TextFormatFlags.PreserveGraphicsClipping | 1860TextFormatFlags.PreserveGraphicsTranslateTransform;
System\Windows\Forms\Design\SplitterPanelDesigner.cs (2)
194TextRenderer.DrawText(g, name, drawFont, new Point(watermarkX, watermarkY), waterMarkTextColor, TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform);
System.Windows.Forms.Tests (376)
System\Windows\Forms\CheckBoxRendererTests.cs (7)
84[InlineData(TextFormatFlags.Default, CheckBoxState.CheckedNormal)] 85[InlineData(TextFormatFlags.Default, CheckBoxState.MixedNormal)] 86[InlineData(TextFormatFlags.GlyphOverhangPadding, CheckBoxState.MixedHot)] 87[InlineData(TextFormatFlags.PreserveGraphicsTranslateTransform, CheckBoxState.CheckedPressed)] 88[InlineData(TextFormatFlags.TextBoxControl, CheckBoxState.UncheckedNormal)] 89public void CheckBoxRenderer_DrawCheckBox_VisualStyleOn_OverloadWithTextFormat(TextFormatFlags textFormat, CheckBoxState cBState) 139CheckBoxRenderer.DrawCheckBox(graphics, point, bounds, control.Text, SystemFonts.DefaultFont, TextFormatFlags.Default, focus, cBState, HWND.Null);
System\Windows\Forms\ControlPaintTests.cs (10)
1948yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4), TextFormatFlags.Default }; 1949yield return new object[] { s, SystemFonts.MenuFont, Color.Red, Rectangle.Empty, TextFormatFlags.VerticalCenter }; 1950yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, -3, -4), TextFormatFlags.VerticalCenter }; 1951yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1952yield return new object[] { s, SystemFonts.MenuFont, Color.Black, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1953yield return new object[] { s, SystemFonts.MenuFont, Color.White, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1954yield return new object[] { s, SystemFonts.MenuFont, Color.Transparent, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1955yield return new object[] { s, SystemFonts.MenuFont, Color.Empty, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1963Rectangle layoutRectangle, TextFormatFlags format) 1977Assert.Throws<ArgumentNullException>("dc", () => ControlPaint.DrawStringDisabled(null, s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4), TextFormatFlags.Default));
System\Windows\Forms\DataGridViewCellTests.cs (56)
5254int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default); 5257height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default, out bool widthTruncated); 5269int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20, TextFormatFlags.Default); 5272height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20, TextFormatFlags.Default, out bool widthTruncated); 5281Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5282Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default, out widthTruncated)); 5292Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10, TextFormatFlags.Default)); 5293Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10, TextFormatFlags.Default, out widthTruncated)); 5305Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth, TextFormatFlags.Default)); 5306Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth, TextFormatFlags.Default, out widthTruncated)); 5311[InlineData((TextFormatFlags)(-1))] 5312public void DataGridViewCell_MeasureTextHeight_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5328Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextPreferredSize(graphics, text, SystemFonts.DefaultFont, 0.2f, TextFormatFlags.Default)); 5332[InlineData("a", TextFormatFlags.Default)] 5333[InlineData("truncate_me", TextFormatFlags.Default)] 5334[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5335[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5336[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5337[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5338public void DataGridViewCell_MeasureTextPreferredSize_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5348Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextPreferredSize(null, "text", SystemFonts.DefaultFont, 0.2f, TextFormatFlags.Default)); 5356Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", null, 0.2f, TextFormatFlags.Default)); 5366Assert.Throws<ArgumentOutOfRangeException>("maxRatio", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", SystemFonts.DefaultFont, maxRatio, TextFormatFlags.Default)); 5370[InlineData((TextFormatFlags)(-1))] 5371public void DataGridViewCell_MeasureTextPreferredSize_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5384Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextSize(graphics, text, SystemFonts.DefaultFont, TextFormatFlags.Default)); 5388[InlineData("a", TextFormatFlags.Default)] 5389[InlineData("truncate_me", TextFormatFlags.Default)] 5390[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5391[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5392[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5393[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5394public void DataGridViewCell_MeasureTextSize_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5404Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextSize(null, "text", SystemFonts.DefaultFont, TextFormatFlags.Default)); 5412Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextSize(graphics, "text", null, TextFormatFlags.Default)); 5416[InlineData((TextFormatFlags)(-1))] 5417public void DataGridViewCell_MeasureTextSize_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5430Assert.Equal(0, DataGridViewCell.MeasureTextWidth(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5434[InlineData("a", TextFormatFlags.Default)] 5435[InlineData("truncate_me", TextFormatFlags.Default)] 5436[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5437[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5438[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5439[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5440public void DataGridViewCell_MeasureTextWidth_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5450Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextWidth(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5458Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextWidth(graphics, "text", null, 10, TextFormatFlags.Default)); 5468Assert.Throws<ArgumentOutOfRangeException>("maxHeight", () => DataGridViewCell.MeasureTextWidth(graphics, "text", SystemFonts.DefaultFont, maxHeight, TextFormatFlags.Default)); 5472[InlineData((TextFormatFlags)(-1))] 5473public void DataGridViewCell_MeasureTextWidth_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (2)
100e.DrawText(TextFormatFlags.Bottom); 117e.DrawText(TextFormatFlags.Left);
System\Windows\Forms\DrawListViewItemEventArgsTests.cs (1)
145e.DrawText(TextFormatFlags.Bottom);
System\Windows\Forms\DrawToolTipEventArgsTests.cs (1)
70e.DrawText(TextFormatFlags.Bottom);
System\Windows\Forms\RadioButtonRendererTests.cs (6)
78[InlineData(TextFormatFlags.Default, RadioButtonState.CheckedNormal)] 79[InlineData(TextFormatFlags.Default, RadioButtonState.CheckedPressed)] 80[InlineData(TextFormatFlags.PreserveGraphicsTranslateTransform, RadioButtonState.CheckedPressed)] 81[InlineData(TextFormatFlags.TextBoxControl, RadioButtonState.UncheckedNormal)] 82public void RadioButtonRenderer_DrawRadioButton_OverloadWithTextFormat(TextFormatFlags textFormat, 124TextFormatFlags.Default,
System\Windows\Forms\TextRendererTests.cs (142)
84yield return new object[] { hint, text, null, Point.Empty, Color.Red, TextFormatFlags.Default, }; 85yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, TextFormatFlags.Default, }; 86yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, TextFormatFlags.Default, }; 87yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, TextFormatFlags.Default, }; 88yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, TextFormatFlags.Default, }; 89yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, TextFormatFlags.Default, }; 91yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.HorizontalCenter }; 92yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 93yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Bottom | TextFormatFlags.Right }; 94yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.SingleLine }; 95yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (TextFormatFlags)1024 }; 96yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.RightToLeft }; 97yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (TextFormatFlags)int.MaxValue }; 104public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, TextFormatFlags flags) 121yield return new object[] { hint, text, null, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default, }; 122yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, Color.Blue, TextFormatFlags.Default, }; 123yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, Color.Blue, TextFormatFlags.Default, }; 124yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, Color.Blue, TextFormatFlags.Default, }; 125yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, Color.Blue, TextFormatFlags.Default, }; 126yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, Color.Blue, TextFormatFlags.Default, }; 127yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Red, TextFormatFlags.Default, }; 128yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Black, TextFormatFlags.Default, }; 129yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.White, TextFormatFlags.Default, }; 130yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Transparent, TextFormatFlags.Default, }; 131yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Empty, TextFormatFlags.Default, }; 133yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 134yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Bottom | TextFormatFlags.Right }; 135yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 136yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (TextFormatFlags)1024 }; 137yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.RightToLeft }; 138yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (TextFormatFlags)int.MaxValue }; 145public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, Color backColor, TextFormatFlags flags) 230yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, TextFormatFlags.Default, }; 231yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, TextFormatFlags.Default, }; 232yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, TextFormatFlags.Default, }; 233yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default, }; 234yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, TextFormatFlags.Default, }; 235yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, TextFormatFlags.Default, }; 236yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, TextFormatFlags.Default, }; 237yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, TextFormatFlags.Default, }; 239yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.HorizontalCenter }; 240yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 241yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Bottom | TextFormatFlags.Right }; 242yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.SingleLine }; 243yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, TextFormatFlags.SingleLine }; 244yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (TextFormatFlags)1024 }; 245yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.RightToLeft }; 246yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (TextFormatFlags)int.MaxValue }; 253public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, TextFormatFlags flags) 270yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, Color.Blue, TextFormatFlags.Default, }; 271yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, Color.Blue, TextFormatFlags.Default, }; 272yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Blue, Color.Blue, TextFormatFlags.Default, }; 273yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default, }; 274yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, Color.Blue, TextFormatFlags.Default, }; 275yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, Color.Blue, TextFormatFlags.Default, }; 276yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, Color.Blue, TextFormatFlags.Default, }; 277yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, Color.Blue, TextFormatFlags.Default, }; 278yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Red, TextFormatFlags.Default, }; 279yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Black, TextFormatFlags.Default, }; 280yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.White, TextFormatFlags.Default, }; 281yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Transparent, TextFormatFlags.Default, }; 282yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Empty, TextFormatFlags.Default, }; 284yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 285yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Bottom | TextFormatFlags.Right }; 286yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 287yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 288yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (TextFormatFlags)1024 }; 289yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.RightToLeft }; 290yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (TextFormatFlags)int.MaxValue }; 297public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, Color backColor, TextFormatFlags flags) 331TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Default); 335TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default); 343TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default); 351TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default); 363TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Default); 367TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default); 375TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default); 383TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default); 438yield return new object[] { "string", null, Size.Empty, TextFormatFlags.Default }; 439yield return new object[] { "string", null, new Size(1, 2), TextFormatFlags.Default }; 440yield return new object[] { "string", null, new Size(100, 200), TextFormatFlags.Default }; 441yield return new object[] { "string", null, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.Default }; 442yield return new object[] { "string", SystemFonts.MenuFont, Size.Empty, TextFormatFlags.Default }; 443yield return new object[] { "string", SystemFonts.MenuFont, new Size(1, 2), TextFormatFlags.Default }; 444yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.Default }; 445yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.Default }; 447yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 448yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.Bottom | TextFormatFlags.Right }; 449yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.SingleLine }; 450yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.SingleLine }; 451yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (TextFormatFlags)1024 }; 452yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.RightToLeft }; 453yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (TextFormatFlags)int.MaxValue }; 458public void TextRenderer_MeasureText_InvokeStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags) 500public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags) 521Assert.Equal(Size.Empty, TextRenderer.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 524Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 527Assert.Equal(Size.Empty, TextRenderer.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 530Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 556TextRenderer.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default); 566Assert.Throws<ArgumentNullException>("dc", () => TextRenderer.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 621TextFormatFlags.ModifyString), 629TextFormatFlags.ModifyString), 636TextFormatFlags.ModifyString), 644TextFormatFlags.ModifyString), 650TextFormatFlags.ModifyString), 655TextFormatFlags.ModifyString), 669public unsafe void TextRenderer_DrawText_Padding_Point(TextFormatFlags flags, Rectangle expectedBounds) 692public unsafe void TextRenderer_DrawText_Padding_Rectangle(TextFormatFlags flags, Rectangle expectedBounds) 713public static TheoryData<TextFormatFlags, Rectangle> TextRenderer_DrawText_Padding_TestData 716{ TextFormatFlags.GlyphOverhangPadding, new Rectangle(3, 0, 70, 12) }, 717{ TextFormatFlags.LeftAndRightPadding, new Rectangle(5, 0, 70, 12) }, 718{ TextFormatFlags.NoPadding, new Rectangle(0, 0, 70, 12) } 723public void TextRenderer_MeasureText_Padding(TextFormatFlags flags, Size expectedSize) 737public static TheoryData<TextFormatFlags, Size> TextRenderer_MeasureText_Padding_TestData 740{ TextFormatFlags.GlyphOverhangPadding, new Size(78, 13) }, 741{ TextFormatFlags.LeftAndRightPadding, new Size(82, 13) }, 742{ TextFormatFlags.NoPadding, new Size(71, 13) } 747public void TextRenderer_DrawText_ApplyState(TextFormatFlags flags, Rectangle expectedBounds) 789public static TheoryData<TextFormatFlags, Rectangle> TextRenderer_DrawText_ApplyState_TestData 792{ TextFormatFlags.Default, new Rectangle(3, 0, 49, 12) }, 793{ TextFormatFlags.PreserveGraphicsTranslateTransform, new Rectangle(8, 10, 49, 12) }, 794{ TextFormatFlags.PreserveGraphicsClipping, new Rectangle(6, 12, 5, 0) }, 795{ TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform, new Rectangle(8, 12, 3, 7) }, 800public void TextRenderer_MeasureText_ApplyState(TextFormatFlags flags, Size expectedSize) 824public static TheoryData<TextFormatFlags, Size> TextRenderer_MeasureText_ApplyState_TestData 829{ TextFormatFlags.Default, new Size(57, 13) }, 830{ TextFormatFlags.PreserveGraphicsTranslateTransform, new Size(57, 13) }, 831{ TextFormatFlags.PreserveGraphicsClipping, new Size(57, 13) }, 832{ TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform, new Size(57, 13) },
System\Windows\Forms\ToolStripButtonTests.cs (101)
1225yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.None, 0, 0, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1226yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Image, 1, 0, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1227yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.ImageAndText, 1, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1229yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1230yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1231yield return new object[] { ContentAlignment.TopLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1232yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1233yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1234yield return new object[] { ContentAlignment.TopCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1235yield return new object[] { ContentAlignment.TopRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1236yield return new object[] { ContentAlignment.TopRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1237yield return new object[] { ContentAlignment.TopRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1239yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1240yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1241yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1242yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1243yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1244yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1245yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1246yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1247yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1249yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1250yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1251yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1252yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1253yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1254yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1255yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1256yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1257yield return new object[] { ContentAlignment.BottomRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1262public void ToolStripButton_OnPaint_InvokeWithOwner_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount, TextFormatFlags expectedTextFormat) 1353public void ToolStripButton_OnPaint_InvokeWithOwnerCantShowKeyboardCues_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount, TextFormatFlags expectedTextFormat)
System\Windows\Forms\ToolStripItemTextRenderEventArgsTests.cs (23)
12yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, TextFormatFlags.Top - 1 }; 13yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Top }; 14yield return new object[] { new ToolStripButton() { RightToLeft = RightToLeft.Yes }, "text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Bottom }; 19public void Ctor_ToolStripItem_String_Rectangle_Color_Font_TextFormatFlags(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format) 37yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, ContentAlignment.TopLeft - 1, TextFormatFlags.Default | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 38yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, ContentAlignment.MiddleCenter, TextFormatFlags.Default | TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 39yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, ContentAlignment.BottomRight, TextFormatFlags.Default | TextFormatFlags.Bottom | TextFormatFlags.Right | TextFormatFlags.HidePrefix }; 40yield return new object[] { new ToolStripButton() { RightToLeft = RightToLeft.Yes }, "text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, (ContentAlignment)(-1), TextFormatFlags.Default | TextFormatFlags.Bottom | TextFormatFlags.Right | TextFormatFlags.RightToLeft | TextFormatFlags.HidePrefix }; 45public void Ctor_ToolStripItem_String_Rectangle_Color_Font_ContentAlignment(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign, TextFormatFlags expectedTextFormat) 66Assert.Throws<ArgumentNullException>("item", () => new ToolStripItemTextRenderEventArgs(graphics, null, "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Top)); 82ToolStripItemTextRenderEventArgs e = new(graphics, new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Blue, SystemFonts.DefaultFont, TextFormatFlags.Top)
System\Windows\Forms\ToolStripRendererTests.cs (13)
294yield return new object[] { new SubToolStripItem(), null, Rectangle.Empty, Color.Empty, null, TextFormatFlags.Left }; 295yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 0, 4), Color.Empty, null, TextFormatFlags.Left }; 296yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 0), Color.Empty, null, TextFormatFlags.Left }; 297yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 4), Color.Empty, null, TextFormatFlags.Left }; 299yield return new object[] { new SubToolStripItem(), "Text", Rectangle.Empty, Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 300yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 0, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 301yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 0), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 302yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 303yield return new object[] { new SubToolStripItem() { Enabled = false }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 304yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical270 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 305yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical90 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 310public void ToolStripRenderer_DrawItemText_Invoke_CallsRenderItemText(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format) 839public void ToolStripRenderer_OnRenderItemText_Invoke_Nop(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format)
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (12)
461yield return new object[] { new Rectangle(1, 2, 3, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 462yield return new object[] { new Rectangle(0, 0, 3, 4), textToDraw, drawDisabled, TextFormatFlags.VerticalCenter }; 463yield return new object[] { new Rectangle(0, 0, 0, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 464yield return new object[] { new Rectangle(0, 0, -1, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 465yield return new object[] { new Rectangle(0, 0, 3, 0), textToDraw, drawDisabled, TextFormatFlags.Default }; 466yield return new object[] { new Rectangle(0, 0, 3, -1), textToDraw, drawDisabled, TextFormatFlags.Default }; 467yield return new object[] { new Rectangle(0, 0, 0, 0), textToDraw, drawDisabled, TextFormatFlags.Default }; 468yield return new object[] { new Rectangle(0, 0, -1, -1), textToDraw, drawDisabled, TextFormatFlags.Default }; 469yield return new object[] { new Rectangle(-1, -2, 3, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 476public void VisualStyleRenderer_DrawText_InvokeIDeviceContextRectangleStringBoolTextFormatFlags_Success(Rectangle bounds, string textToDraw, bool drawDisabled, TextFormatFlags flags) 494Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", true, TextFormatFlags.Default)); 495Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", false, TextFormatFlags.Default));
Text\FontMetrics.cs (1)
85Size measure = screen.HDC.MeasureText("Windows Foundation Classes", hfont, proposedSize, (TextFormatFlags)dt);
TextBoxBaseTests.cs (1)
5128int width = TextRenderer.MeasureText(control.Text, control.Font, Size.Empty, TextFormatFlags.SingleLine).Width;