768 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) 3958internal 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; 1179TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 2315TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 2320if ((flags & TextFormatFlags.SingleLine) != 0) 2322flags |= 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); 851TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode); 887if ((flags & TextFormatFlags.SingleLine) != 0) 889flags |= 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); 734TextFormatFlags flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment( 743if ((flags & TextFormatFlags.SingleLine) != 0) 745flags |= 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)
213textSize = 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)
1981TextFormatFlags format) 1998TextFormatFlags format, 2502internal static TextFormatFlags ConvertAlignmentToTextFormat(ContentAlignment alignment) 2505TextFormatFlags flags = TextFormatFlags.Top | TextFormatFlags.Left; 2509flags |= TextFormatFlags.Bottom; 2513flags |= TextFormatFlags.VerticalCenter; 2518flags |= TextFormatFlags.Right; 2522flags |= TextFormatFlags.HorizontalCenter; 2585internal static TextFormatFlags CreateTextFormatFlags( 2592TextFormatFlags flags = ConvertAlignmentToTextFormat(alignment); 2597flags |= TextFormatFlags.WordBreak | TextFormatFlags.TextBoxControl; 2601flags |= TextFormatFlags.EndEllipsis; 2607flags |= TextFormatFlags.RightToLeft; 2613flags |= TextFormatFlags.NoPrefix; 2618flags |= 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 (21)
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)
1857TextFormatFlags formatFlags = 1858TextFormatFlags.WordBreak | 1859TextFormatFlags.EndEllipsis | 1860TextFormatFlags.TextBoxControl | 1861TextFormatFlags.PreserveGraphicsClipping | 1862TextFormatFlags.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\Design\ToolStripCollectionEditor.ToolStripItemEditorForm.cs (8)
784TextFormatFlags format = TextFormatFlags.Top | TextFormatFlags.Left; 906TextFormatFlags flags = TextFormatFlags.EndEllipsis | TextFormatFlags.PreserveGraphicsTranslateTransform | TextFormatFlags.PreserveGraphicsClipping; 909flags |= TextFormatFlags.RightToLeft;
System.Windows.Forms.Tests (376)
System\Windows\Forms\CheckBoxRendererTests.cs (7)
86[InlineData(TextFormatFlags.Default, CheckBoxState.CheckedNormal)] 87[InlineData(TextFormatFlags.Default, CheckBoxState.MixedNormal)] 88[InlineData(TextFormatFlags.GlyphOverhangPadding, CheckBoxState.MixedHot)] 89[InlineData(TextFormatFlags.PreserveGraphicsTranslateTransform, CheckBoxState.CheckedPressed)] 90[InlineData(TextFormatFlags.TextBoxControl, CheckBoxState.UncheckedNormal)] 91public void CheckBoxRenderer_DrawCheckBox_VisualStyleOn_OverloadWithTextFormat(TextFormatFlags textFormat, CheckBoxState cBState) 141CheckBoxRenderer.DrawCheckBox(graphics, point, bounds, control.Text, SystemFonts.DefaultFont, TextFormatFlags.Default, focus, cBState, HWND.Null);
System\Windows\Forms\ControlPaintTests.cs (10)
1950yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4), TextFormatFlags.Default }; 1951yield return new object[] { s, SystemFonts.MenuFont, Color.Red, Rectangle.Empty, TextFormatFlags.VerticalCenter }; 1952yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, -3, -4), TextFormatFlags.VerticalCenter }; 1953yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1954yield return new object[] { s, SystemFonts.MenuFont, Color.Black, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1955yield return new object[] { s, SystemFonts.MenuFont, Color.White, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1956yield return new object[] { s, SystemFonts.MenuFont, Color.Transparent, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1957yield return new object[] { s, SystemFonts.MenuFont, Color.Empty, new Rectangle(1, 2, 3, 4), TextFormatFlags.VerticalCenter }; 1965Rectangle layoutRectangle, TextFormatFlags format) 1979Assert.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)
5256int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default); 5259height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default, out bool widthTruncated); 5271int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20, TextFormatFlags.Default); 5274height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20, TextFormatFlags.Default, out bool widthTruncated); 5283Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5284Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default, out widthTruncated)); 5294Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10, TextFormatFlags.Default)); 5295Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10, TextFormatFlags.Default, out widthTruncated)); 5307Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth, TextFormatFlags.Default)); 5308Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth, TextFormatFlags.Default, out widthTruncated)); 5313[InlineData((TextFormatFlags)(-1))] 5314public void DataGridViewCell_MeasureTextHeight_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5330Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextPreferredSize(graphics, text, SystemFonts.DefaultFont, 0.2f, TextFormatFlags.Default)); 5334[InlineData("a", TextFormatFlags.Default)] 5335[InlineData("truncate_me", TextFormatFlags.Default)] 5336[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5337[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5338[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5339[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5340public void DataGridViewCell_MeasureTextPreferredSize_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5350Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextPreferredSize(null, "text", SystemFonts.DefaultFont, 0.2f, TextFormatFlags.Default)); 5358Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", null, 0.2f, TextFormatFlags.Default)); 5368Assert.Throws<ArgumentOutOfRangeException>("maxRatio", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", SystemFonts.DefaultFont, maxRatio, TextFormatFlags.Default)); 5372[InlineData((TextFormatFlags)(-1))] 5373public void DataGridViewCell_MeasureTextPreferredSize_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5386Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextSize(graphics, text, SystemFonts.DefaultFont, TextFormatFlags.Default)); 5390[InlineData("a", TextFormatFlags.Default)] 5391[InlineData("truncate_me", TextFormatFlags.Default)] 5392[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5393[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5394[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5395[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5396public void DataGridViewCell_MeasureTextSize_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5406Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextSize(null, "text", SystemFonts.DefaultFont, TextFormatFlags.Default)); 5414Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextSize(graphics, "text", null, TextFormatFlags.Default)); 5418[InlineData((TextFormatFlags)(-1))] 5419public void DataGridViewCell_MeasureTextSize_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags) 5432Assert.Equal(0, DataGridViewCell.MeasureTextWidth(graphics, text, SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5436[InlineData("a", TextFormatFlags.Default)] 5437[InlineData("truncate_me", TextFormatFlags.Default)] 5438[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default)] 5439[InlineData("truncate_me\r\nnew\rn\nnew", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5440[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default)] 5441[InlineData("truncate_me\r\truncate_me_again", TextFormatFlags.Default | TextFormatFlags.SingleLine)] 5442public void DataGridViewCell_MeasureTextWidth_NonEmptyText_ReturnsExpected(string text, TextFormatFlags flags) 5452Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextWidth(null, "text", SystemFonts.DefaultFont, 10, TextFormatFlags.Default)); 5460Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextWidth(graphics, "text", null, 10, TextFormatFlags.Default)); 5470Assert.Throws<ArgumentOutOfRangeException>("maxHeight", () => DataGridViewCell.MeasureTextWidth(graphics, "text", SystemFonts.DefaultFont, maxHeight, TextFormatFlags.Default)); 5474[InlineData((TextFormatFlags)(-1))] 5475public void DataGridViewCell_MeasureTextWidth_InvalidFlags_ThrowsInvalidEnumArgumentException(TextFormatFlags flags)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (2)
102e.DrawText(TextFormatFlags.Bottom); 119e.DrawText(TextFormatFlags.Left);
System\Windows\Forms\DrawListViewItemEventArgsTests.cs (1)
147e.DrawText(TextFormatFlags.Bottom);
System\Windows\Forms\DrawToolTipEventArgsTests.cs (1)
72e.DrawText(TextFormatFlags.Bottom);
System\Windows\Forms\RadioButtonRendererTests.cs (6)
81[InlineData(TextFormatFlags.Default, RadioButtonState.CheckedNormal)] 82[InlineData(TextFormatFlags.Default, RadioButtonState.CheckedPressed)] 83[InlineData(TextFormatFlags.PreserveGraphicsTranslateTransform, RadioButtonState.CheckedPressed)] 84[InlineData(TextFormatFlags.TextBoxControl, RadioButtonState.UncheckedNormal)] 85public void RadioButtonRenderer_DrawRadioButton_OverloadWithTextFormat(TextFormatFlags textFormat, 135TextFormatFlags.Default,
System\Windows\Forms\TextRendererTests.cs (142)
86yield return new object[] { hint, text, null, Point.Empty, Color.Red, TextFormatFlags.Default, }; 87yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, TextFormatFlags.Default, }; 88yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, TextFormatFlags.Default, }; 89yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, TextFormatFlags.Default, }; 90yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, TextFormatFlags.Default, }; 91yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, TextFormatFlags.Default, }; 93yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.HorizontalCenter }; 94yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 95yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Bottom | TextFormatFlags.Right }; 96yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.SingleLine }; 97yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (TextFormatFlags)1024 }; 98yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.RightToLeft }; 99yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (TextFormatFlags)int.MaxValue }; 106public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, TextFormatFlags flags) 123yield return new object[] { hint, text, null, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default, }; 124yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, Color.Blue, TextFormatFlags.Default, }; 125yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, Color.Blue, TextFormatFlags.Default, }; 126yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, Color.Blue, TextFormatFlags.Default, }; 127yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, Color.Blue, TextFormatFlags.Default, }; 128yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, Color.Blue, TextFormatFlags.Default, }; 129yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Red, TextFormatFlags.Default, }; 130yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Black, TextFormatFlags.Default, }; 131yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.White, TextFormatFlags.Default, }; 132yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Transparent, TextFormatFlags.Default, }; 133yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Empty, TextFormatFlags.Default, }; 135yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 136yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Bottom | TextFormatFlags.Right }; 137yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 138yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (TextFormatFlags)1024 }; 139yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.RightToLeft }; 140yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (TextFormatFlags)int.MaxValue }; 147public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, Color backColor, TextFormatFlags flags) 232yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, TextFormatFlags.Default, }; 233yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, TextFormatFlags.Default, }; 234yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, TextFormatFlags.Default, }; 235yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default, }; 236yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, TextFormatFlags.Default, }; 237yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, TextFormatFlags.Default, }; 238yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, TextFormatFlags.Default, }; 239yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, TextFormatFlags.Default, }; 241yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.HorizontalCenter }; 242yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 243yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Bottom | TextFormatFlags.Right }; 244yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.SingleLine }; 245yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, TextFormatFlags.SingleLine }; 246yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (TextFormatFlags)1024 }; 247yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.RightToLeft }; 248yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (TextFormatFlags)int.MaxValue }; 255public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, TextFormatFlags flags) 272yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, Color.Blue, TextFormatFlags.Default, }; 273yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, Color.Blue, TextFormatFlags.Default, }; 274yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Blue, Color.Blue, TextFormatFlags.Default, }; 275yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default, }; 276yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, Color.Blue, TextFormatFlags.Default, }; 277yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, Color.Blue, TextFormatFlags.Default, }; 278yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, Color.Blue, TextFormatFlags.Default, }; 279yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, Color.Blue, TextFormatFlags.Default, }; 280yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Red, TextFormatFlags.Default, }; 281yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Black, TextFormatFlags.Default, }; 282yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.White, TextFormatFlags.Default, }; 283yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Transparent, TextFormatFlags.Default, }; 284yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Empty, TextFormatFlags.Default, }; 286yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 287yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Bottom | TextFormatFlags.Right }; 288yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 289yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, Color.Blue, TextFormatFlags.SingleLine }; 290yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (TextFormatFlags)1024 }; 291yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.RightToLeft }; 292yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (TextFormatFlags)int.MaxValue }; 299public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, Color backColor, TextFormatFlags flags) 333TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Default); 337TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default); 345TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default); 353TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default); 365TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, TextFormatFlags.Default); 369TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, TextFormatFlags.Default); 377TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default); 385TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default); 440yield return new object[] { "string", null, Size.Empty, TextFormatFlags.Default }; 441yield return new object[] { "string", null, new Size(1, 2), TextFormatFlags.Default }; 442yield return new object[] { "string", null, new Size(100, 200), TextFormatFlags.Default }; 443yield return new object[] { "string", null, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.Default }; 444yield return new object[] { "string", SystemFonts.MenuFont, Size.Empty, TextFormatFlags.Default }; 445yield return new object[] { "string", SystemFonts.MenuFont, new Size(1, 2), TextFormatFlags.Default }; 446yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.Default }; 447yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.Default }; 449yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.VerticalCenter | TextFormatFlags.HorizontalCenter }; 450yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.Bottom | TextFormatFlags.Right }; 451yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.SingleLine }; 452yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue), TextFormatFlags.SingleLine }; 453yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (TextFormatFlags)1024 }; 454yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), TextFormatFlags.RightToLeft }; 455yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (TextFormatFlags)int.MaxValue }; 460public void TextRenderer_MeasureText_InvokeStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags) 502public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize, TextFormatFlags flags) 523Assert.Equal(Size.Empty, TextRenderer.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 526Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 529Assert.Equal(Size.Empty, TextRenderer.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 532Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 558TextRenderer.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default); 568Assert.Throws<ArgumentNullException>("dc", () => TextRenderer.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default)); 623TextFormatFlags.ModifyString), 631TextFormatFlags.ModifyString), 638TextFormatFlags.ModifyString), 646TextFormatFlags.ModifyString), 652TextFormatFlags.ModifyString), 657TextFormatFlags.ModifyString), 671public unsafe void TextRenderer_DrawText_Padding_Point(TextFormatFlags flags, Rectangle expectedBounds) 694public unsafe void TextRenderer_DrawText_Padding_Rectangle(TextFormatFlags flags, Rectangle expectedBounds) 715public static TheoryData<TextFormatFlags, Rectangle> TextRenderer_DrawText_Padding_TestData 718{ TextFormatFlags.GlyphOverhangPadding, new Rectangle(3, 0, 70, 12) }, 719{ TextFormatFlags.LeftAndRightPadding, new Rectangle(5, 0, 70, 12) }, 720{ TextFormatFlags.NoPadding, new Rectangle(0, 0, 70, 12) } 725public void TextRenderer_MeasureText_Padding(TextFormatFlags flags, Size expectedSize) 739public static TheoryData<TextFormatFlags, Size> TextRenderer_MeasureText_Padding_TestData 742{ TextFormatFlags.GlyphOverhangPadding, new Size(78, 13) }, 743{ TextFormatFlags.LeftAndRightPadding, new Size(82, 13) }, 744{ TextFormatFlags.NoPadding, new Size(71, 13) } 749public void TextRenderer_DrawText_ApplyState(TextFormatFlags flags, Rectangle expectedBounds) 791public static TheoryData<TextFormatFlags, Rectangle> TextRenderer_DrawText_ApplyState_TestData 794{ TextFormatFlags.Default, new Rectangle(3, 0, 49, 12) }, 795{ TextFormatFlags.PreserveGraphicsTranslateTransform, new Rectangle(8, 10, 49, 12) }, 796{ TextFormatFlags.PreserveGraphicsClipping, new Rectangle(6, 12, 5, 0) }, 797{ TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform, new Rectangle(8, 12, 3, 7) }, 802public void TextRenderer_MeasureText_ApplyState(TextFormatFlags flags, Size expectedSize) 826public static TheoryData<TextFormatFlags, Size> TextRenderer_MeasureText_ApplyState_TestData 831{ TextFormatFlags.Default, new Size(57, 13) }, 832{ TextFormatFlags.PreserveGraphicsTranslateTransform, new Size(57, 13) }, 833{ TextFormatFlags.PreserveGraphicsClipping, new Size(57, 13) }, 834{ TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform, new Size(57, 13) },
System\Windows\Forms\ToolStripButtonTests.cs (101)
1227yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.None, 0, 0, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1228yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Image, 1, 0, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1229yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.ImageAndText, 1, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1231yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1232yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1233yield return new object[] { ContentAlignment.TopLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1234yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1235yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1236yield return new object[] { ContentAlignment.TopCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1237yield return new object[] { ContentAlignment.TopRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1238yield return new object[] { ContentAlignment.TopRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1239yield return new object[] { ContentAlignment.TopRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 1241yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1242yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1243yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1244yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1245yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1246yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1247yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1248yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1249yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.VerticalCenter | TextFormatFlags.HidePrefix }; 1251yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1252yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1253yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Left | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1254yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1255yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1256yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.HorizontalCenter | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1257yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix | TextFormatFlags.RightToLeft }; 1258yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1259yield return new object[] { ContentAlignment.BottomRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1, TextFormatFlags.Right | TextFormatFlags.Bottom | TextFormatFlags.HidePrefix }; 1264public void ToolStripButton_OnPaint_InvokeWithOwner_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount, TextFormatFlags expectedTextFormat) 1355public void ToolStripButton_OnPaint_InvokeWithOwnerCantShowKeyboardCues_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount, TextFormatFlags expectedTextFormat)
System\Windows\Forms\ToolStripItemTextRenderEventArgsTests.cs (23)
14yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, TextFormatFlags.Top - 1 }; 15yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Top }; 16yield return new object[] { new ToolStripButton() { RightToLeft = RightToLeft.Yes }, "text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Bottom }; 21public void Ctor_ToolStripItem_String_Rectangle_Color_Font_TextFormatFlags(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format) 39yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, ContentAlignment.TopLeft - 1, TextFormatFlags.Default | TextFormatFlags.Top | TextFormatFlags.HidePrefix }; 40yield 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 }; 41yield 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 }; 42yield 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 }; 47public void Ctor_ToolStripItem_String_Rectangle_Color_Font_ContentAlignment(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign, TextFormatFlags expectedTextFormat) 68Assert.Throws<ArgumentNullException>("item", () => new ToolStripItemTextRenderEventArgs(graphics, null, "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont, TextFormatFlags.Top)); 84ToolStripItemTextRenderEventArgs e = new(graphics, new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Blue, SystemFonts.DefaultFont, TextFormatFlags.Top)
System\Windows\Forms\ToolStripRendererTests.cs (13)
296yield return new object[] { new SubToolStripItem(), null, Rectangle.Empty, Color.Empty, null, TextFormatFlags.Left }; 297yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 0, 4), Color.Empty, null, TextFormatFlags.Left }; 298yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 0), Color.Empty, null, TextFormatFlags.Left }; 299yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 4), Color.Empty, null, TextFormatFlags.Left }; 301yield return new object[] { new SubToolStripItem(), "Text", Rectangle.Empty, Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 302yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 0, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 303yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 0), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 304yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 305yield return new object[] { new SubToolStripItem() { Enabled = false }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 306yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical270 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 307yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical90 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont, TextFormatFlags.Left }; 312public void ToolStripRenderer_DrawItemText_Invoke_CallsRenderItemText(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format) 841public void ToolStripRenderer_OnRenderItemText_Invoke_Nop(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, TextFormatFlags format)
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (12)
463yield return new object[] { new Rectangle(1, 2, 3, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 464yield return new object[] { new Rectangle(0, 0, 3, 4), textToDraw, drawDisabled, TextFormatFlags.VerticalCenter }; 465yield return new object[] { new Rectangle(0, 0, 0, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 466yield return new object[] { new Rectangle(0, 0, -1, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 467yield return new object[] { new Rectangle(0, 0, 3, 0), textToDraw, drawDisabled, TextFormatFlags.Default }; 468yield return new object[] { new Rectangle(0, 0, 3, -1), textToDraw, drawDisabled, TextFormatFlags.Default }; 469yield return new object[] { new Rectangle(0, 0, 0, 0), textToDraw, drawDisabled, TextFormatFlags.Default }; 470yield return new object[] { new Rectangle(0, 0, -1, -1), textToDraw, drawDisabled, TextFormatFlags.Default }; 471yield return new object[] { new Rectangle(-1, -2, 3, 4), textToDraw, drawDisabled, TextFormatFlags.Default }; 478public void VisualStyleRenderer_DrawText_InvokeIDeviceContextRectangleStringBoolTextFormatFlags_Success(Rectangle bounds, string textToDraw, bool drawDisabled, TextFormatFlags flags) 496Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", true, TextFormatFlags.Default)); 497Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", false, TextFormatFlags.Default));
Text\FontMetrics.cs (1)
87Size measure = screen.HDC.MeasureText("Windows Foundation Classes", hfont, proposedSize, (TextFormatFlags)dt);
TextBoxBaseTests.cs (1)
5130int width = TextRenderer.MeasureText(control.Text, control.Font, Size.Empty, TextFormatFlags.SingleLine).Width;