768 references to TextFormatFlags
System.Windows.Forms (371)
System\Windows\Forms\Controls\Buttons\ButtonBase.cs (2)
1023
internal virtual
TextFormatFlags
CreateTextFormatFlags()
1028
return
TextFormatFlags
.Default;
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (3)
92
/// Get <see cref="
TextFormatFlags
"/> for rendering text using GDI (<see cref="TextRenderer"/>).
94
internal virtual
TextFormatFlags
CreateTextFormatFlags()
490
TextFormatFlags
formatFlags = CreateTextFormatFlags();
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (5)
50
public
TextFormatFlags
GdiTextFormatFlags { get; set; } =
TextFormatFlags
.WordBreak |
TextFormatFlags
.TextBoxControl;
100
public
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)"/>
136
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
141
/// <inheritdoc cref="DrawButton(Graphics, Rectangle, string?, Font?,
TextFormatFlags
, Image, Rectangle, bool, PushButtonState)"/>
142
public 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)"/>
211
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
225
TextFormatFlags
flags,
237
TextFormatFlags
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)"/>
97
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
101
/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?,
TextFormatFlags
, Image, Rectangle, bool, CheckBoxState)"/>
108
TextFormatFlags
flags,
118
TextFormatFlags
flags,
155
/// <inheritdoc cref="DrawCheckBox(Graphics, Point, Rectangle, string?, Font?,
TextFormatFlags
, Image, Rectangle, bool, CheckBoxState)"/>
171
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
186
TextFormatFlags
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)" />
98
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
102
/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?,
TextFormatFlags
, Image, Rectangle, bool, RadioButtonState)" />
109
TextFormatFlags
flags,
122
TextFormatFlags
flags,
155
/// <inheritdoc cref="DrawRadioButton(Graphics, Point, Rectangle, string?, Font?,
TextFormatFlags
, Image, Rectangle, bool, RadioButtonState)" />
171
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
186
TextFormatFlags
flags,
209
TextFormatFlags
flags,
System\Windows\Forms\Controls\ComboBox\ComboBox.cs (2)
774
Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)),
TextFormatFlags
.SingleLine);
785
Size textSize = TextRenderer.MeasureText(LayoutUtils.TestString, Font, new Size(short.MaxValue, (int)(FontHeight * 1.25)),
TextFormatFlags
.SingleLine);
System\Windows\Forms\Controls\ComboBox\ComboBoxRenderer.cs (4)
60
DrawTextBox(g, bounds, comboBoxText, font,
TextFormatFlags
.TextBoxControl, state);
68
DrawTextBox(g, bounds, comboBoxText, font, textBounds,
TextFormatFlags
.TextBoxControl, state);
74
public static void DrawTextBox(Graphics g, Rectangle bounds, string? comboBoxText, Font? font,
TextFormatFlags
flags, ComboBoxState state)
86
public 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)
304
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
987
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (15)
19
private const
TextFormatFlags
TextFormatSupportedFlags =
TextFormatFlags
.SingleLine
20
| /*TextFormatFlags.NoFullWidthCharacterBreak |*/
TextFormatFlags
.WordBreak |
TextFormatFlags
.NoPrefix;
2321
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(rightToLeft, cellStyle.Alignment, cellStyle.WrapMode);
2524
TextFormatFlags
flags) => MeasureTextHeight(
2538
TextFormatFlags
flags,
2547
throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(
TextFormatFlags
));
2563
TextFormatFlags
flags)
2571
throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(
TextFormatFlags
));
2608
TextFormatFlags
flags)
2615
throw new InvalidEnumArgumentException(nameof(flags), (int)flags, typeof(
TextFormatFlags
));
2629
TextFormatFlags
flags)
2634
if (oneLineSize.Height >= maxHeight || (flags &
TextFormatFlags
.SingleLine) != 0)
3958
internal static bool TextFitsInBounds(Graphics graphics, string text, Font font, Size maxBounds,
TextFormatFlags
flags)
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (4)
500
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
966
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
971
if ((flags &
TextFormatFlags
.SingleLine) != 0)
973
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (5)
831
return MeasureTextHeight(graphics, " ", cellStyle.Font!, int.MaxValue,
TextFormatFlags
.Default) + adjustment;
1179
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
2315
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
2320
if ((flags &
TextFormatFlags
.SingleLine) != 0)
2322
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (4)
561
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
959
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(
1022
if ((flags &
TextFormatFlags
.SingleLine) != 0)
1024
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (4)
533
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
851
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
887
if ((flags &
TextFormatFlags
.SingleLine) != 0)
889
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (5)
224
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
413
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
734
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(
743
if ((flags &
TextFormatFlags
.SingleLine) != 0)
745
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (4)
148
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
318
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
323
if ((flags &
TextFormatFlags
.SingleLine) != 0)
325
flags |=
TextFormatFlags
.EndEllipsis;
System\Windows\Forms\Controls\DataGridView\DataGridViewUtilities.cs (66)
36
internal static
TextFormatFlags
ComputeTextFormatFlagsForCellStyleAlignment(
41
TextFormatFlags
tff;
45
tff =
TextFormatFlags
.Top;
48
tff |=
TextFormatFlags
.Right;
52
tff |=
TextFormatFlags
.Left;
57
tff =
TextFormatFlags
.Top |
TextFormatFlags
.HorizontalCenter;
60
tff =
TextFormatFlags
.Top;
63
tff |=
TextFormatFlags
.Left;
67
tff |=
TextFormatFlags
.Right;
72
tff =
TextFormatFlags
.VerticalCenter;
75
tff |=
TextFormatFlags
.Right;
79
tff |=
TextFormatFlags
.Left;
84
tff =
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter;
87
tff =
TextFormatFlags
.VerticalCenter;
90
tff |=
TextFormatFlags
.Left;
94
tff |=
TextFormatFlags
.Right;
99
tff =
TextFormatFlags
.Bottom;
102
tff |=
TextFormatFlags
.Right;
106
tff |=
TextFormatFlags
.Left;
111
tff =
TextFormatFlags
.Bottom |
TextFormatFlags
.HorizontalCenter;
114
tff =
TextFormatFlags
.Bottom;
117
tff |=
TextFormatFlags
.Left;
121
tff |=
TextFormatFlags
.Right;
126
tff =
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter;
132
tff |=
TextFormatFlags
.SingleLine;
137
tff |=
TextFormatFlags
.WordBreak;
140
tff |=
TextFormatFlags
.NoPrefix;
141
tff |=
TextFormatFlags
.PreserveGraphicsClipping;
144
tff |=
TextFormatFlags
.RightToLeft;
159
TextFormatFlags
flags)
307
TextFormatFlags
flags,
316
TextFormatFlags
flags,
320
if ((flags &
TextFormatFlags
.SingleLine) != 0)
325
flags |=
TextFormatFlags
.EndEllipsis;
352
TextFormatFlags
flags,
359
if ((flags &
TextFormatFlags
.RightToLeft) != 0)
444
internal static bool ValidTextFormatFlags(
TextFormatFlags
flags)
447
return (flags & ~(
TextFormatFlags
.Bottom |
448
TextFormatFlags
.Default |
449
TextFormatFlags
.EndEllipsis |
450
TextFormatFlags
.ExpandTabs |
451
TextFormatFlags
.ExternalLeading |
452
TextFormatFlags
.HidePrefix |
453
TextFormatFlags
.HorizontalCenter |
454
TextFormatFlags
.Internal |
455
TextFormatFlags
.Left |
456
TextFormatFlags
.ModifyString |
457
TextFormatFlags
.NoClipping |
458
TextFormatFlags
.NoFullWidthCharacterBreak |
459
TextFormatFlags
.NoPrefix |
460
TextFormatFlags
.PathEllipsis |
461
TextFormatFlags
.PrefixOnly |
462
TextFormatFlags
.PreserveGraphicsClipping |
463
TextFormatFlags
.PreserveGraphicsTranslateTransform |
464
TextFormatFlags
.Right |
465
TextFormatFlags
.RightToLeft |
466
TextFormatFlags
.SingleLine |
467
TextFormatFlags
.TextBoxControl |
468
TextFormatFlags
.Top |
469
TextFormatFlags
.VerticalCenter |
470
TextFormatFlags
.WordBreak |
471
TextFormatFlags
.WordEllipsis)) == 0;
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (11)
411
TextFormatFlags
textFlags =
TextFormatFlags
.TextBoxControl |
TextFormatFlags
.WordBreak
412
|
TextFormatFlags
.PreserveGraphicsTranslateTransform |
TextFormatFlags
.PreserveGraphicsClipping;
416
textFlags |=
TextFormatFlags
.HidePrefix;
421
textFlags |= (
TextFormatFlags
.Right |
TextFormatFlags
.RightToLeft);
515
textSize = hdc.HDC.MeasureText(Text, hfont, new Size(textRectangle.Width, int.MaxValue), (
TextFormatFlags
)flags);
519
hdc.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);
100
TextFormatFlags
flags,
109
TextFormatFlags
flags,
131
TextFormatFlags
flags,
141
TextFormatFlags
flags,
172
TextFormatFlags
flags,
191
if ((flags &
TextFormatFlags
.Right) ==
TextFormatFlags
.Right)
219
if ((flags &
TextFormatFlags
.Right) ==
TextFormatFlags
.Right)
278
TextFormatFlags
flags)
294
if ((flags &
TextFormatFlags
.Right) ==
TextFormatFlags
.Right)
System\Windows\Forms\Controls\Labels\Label.cs (13)
913
private
TextFormatFlags
CreateTextFormatFlags()
919
private protected
TextFormatFlags
CreateTextFormatFlags(Size constrainingSize)
926
TextFormatFlags
flags = ControlPaint.CreateTextFormatFlags(this, TextAlign, AutoEllipsis, UseMnemonic);
934
flags &= ~(
TextFormatFlags
.WordBreak |
TextFormatFlags
.TextBoxControl);
1074
TextFormatFlags
format = FlatStyle == FlatStyle.System ?
TextFormatFlags
.Default : CreateTextFormatFlags(proposedConstraints);
1111
TextFormatFlags
flags = CreateTextFormatFlags();
1114
if ((flags &
TextFormatFlags
.NoPadding) ==
TextFormatFlags
.NoPadding)
1118
else if ((flags &
TextFormatFlags
.LeftAndRightPadding) ==
TextFormatFlags
.LeftAndRightPadding)
1295
TextFormatFlags
flags = CreateTextFormatFlags();
System\Windows\Forms\Controls\Labels\LinkLabel.cs (5)
558
TextFormatFlags
flags = CreateTextFormatFlags(clientSize);
565
if ((flags &
TextFormatFlags
.NoPadding) ==
TextFormatFlags
.NoPadding)
569
else if ((flags &
TextFormatFlags
.LeftAndRightPadding) ==
TextFormatFlags
.LeftAndRightPadding)
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (6)
686
TextFormatFlags
flags =
TextFormatFlags
.Default;
687
flags |=
TextFormatFlags
.NoPrefix;
691
flags |=
TextFormatFlags
.ExpandTabs;
697
flags |=
TextFormatFlags
.RightToLeft;
698
flags |=
TextFormatFlags
.Right;
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (6)
128
TextFormatFlags
flags = (hAlign == HorizontalAlignment.Left) ?
TextFormatFlags
.Left :
129
((hAlign == HorizontalAlignment.Center) ?
TextFormatFlags
.HorizontalCenter :
130
TextFormatFlags
.Right);
131
flags |=
TextFormatFlags
.WordEllipsis;
139
public void DrawText(
TextFormatFlags
flags)
System\Windows\Forms\Controls\ListView\DrawListViewItemEventArgs.cs (2)
84
public void DrawText() => DrawText(
TextFormatFlags
.Left);
89
public void DrawText(
TextFormatFlags
flags)
System\Windows\Forms\Controls\ListView\DrawListViewSubItemEventArgs.cs (6)
124
TextFormatFlags
flags = (hAlign == HorizontalAlignment.Left) ?
TextFormatFlags
.Left :
125
((hAlign == HorizontalAlignment.Center) ?
TextFormatFlags
.HorizontalCenter :
126
TextFormatFlags
.Right);
127
flags |=
TextFormatFlags
.WordEllipsis;
135
public void DrawText(
TextFormatFlags
flags)
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.MeasureTextHelper.cs (10)
29
TextFormatFlags
.PreserveGraphicsClipping |
TextFormatFlags
.PreserveGraphicsTranslateTransform);
39
TextFormatFlags
.PreserveGraphicsClipping
40
|
TextFormatFlags
.PreserveGraphicsTranslateTransform
41
|
TextFormatFlags
.LeftAndRightPadding
42
|
TextFormatFlags
.WordBreak
43
|
TextFormatFlags
.NoFullWidthCharacterBreak);
45
public 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)
65
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
72
public static void DrawTabItem(Graphics g, Rectangle bounds, string? tabItemText, Font? font,
TextFormatFlags
flags, bool focused, TabItemState state)
114
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.SingleLine,
121
public 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)
868
TextFormatFlags
flags =
TextFormatFlags
.NoPadding |
TextFormatFlags
.Top |
TextFormatFlags
.EndEllipsis;
873
flags |=
TextFormatFlags
.RightToLeft;
877
flags |=
TextFormatFlags
.HorizontalCenter;
881
flags |=
TextFormatFlags
.Right;
885
flags |=
TextFormatFlags
.Left;
892
flags &= ~
TextFormatFlags
.RightToLeft;
896
flags |=
TextFormatFlags
.HorizontalCenter;
900
flags |=
TextFormatFlags
.Left;
904
flags |=
TextFormatFlags
.Right;
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (4)
840
TextFormatFlags
format =
TextFormatFlags
.NoPrefix;
843
format |=
TextFormatFlags
.SingleLine;
847
format |=
TextFormatFlags
.WordBreak;
System\Windows\Forms\Controls\TextBox\TextBoxRenderer.cs (4)
53
DrawTextBox(g, bounds, textBoxText, font,
TextFormatFlags
.TextBoxControl, state);
61
DrawTextBox(g, bounds, textBoxText, font, textBounds,
TextFormatFlags
.TextBoxControl, state);
67
public static void DrawTextBox(Graphics g, Rectangle bounds, string? textBoxText, Font? font,
TextFormatFlags
flags, TextBoxState state)
78
public 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)
69
public virtual
TextFormatFlags
TextFormat
82
internal static
TextFormatFlags
ContentAlignmentToTextFormat(ContentAlignment alignment, bool rightToLeft)
84
TextFormatFlags
textFormat =
TextFormatFlags
.Default;
88
textFormat |=
TextFormatFlags
.RightToLeft;
129
layoutOptions.GdiTextFormatFlags = Owner.ShowKeyboardCues ? layoutOptions.GdiTextFormatFlags : layoutOptions.GdiTextFormatFlags |
TextFormatFlags
.HidePrefix;
System\Windows\Forms\Controls\ToolStrips\ToolStripItemTextRenderEventArgs.cs (3)
26
TextFormatFlags
format)
59
TextFormat = (item.ShowKeyboardCues) ? TextFormat : TextFormat |
TextFormatFlags
.HidePrefix;
96
public
TextFormatFlags
TextFormat { get; set; }
System\Windows\Forms\Controls\ToolStrips\ToolStripRenderer.cs (1)
870
TextFormatFlags
textFormat = e.TextFormat;
System\Windows\Forms\Controls\TreeView\TreeView.cs (2)
2848
TextRenderer.DrawText(g, node.Text, font, bounds, color,
TextFormatFlags
.Default);
2855
TextRenderer.DrawText(g, node.Text, font, bounds, color,
TextFormatFlags
.Default);
System\Windows\Forms\Dialogs\ThreadExceptionDialog.cs (1)
213
textSize = Size.Ceiling(TextRenderer.MeasureText(messageText, Font, textSize,
TextFormatFlags
.WordBreak));
System\Windows\Forms\Layout\LayoutUtils.cs (1)
50
Size textSize = TextRenderer.MeasureText(obj.ToString(), font, new Size(short.MaxValue, short.MaxValue),
TextFormatFlags
.SingleLine);
System\Windows\Forms\Layout\LayoutUtils.MeasureTextCache.cs (4)
29
public Size GetTextSize(string? text, Font? font, Size proposedConstraints,
TextFormatFlags
flags)
99
public bool TextRequiresWordBreak(string? text, Font? font, Size size,
TextFormatFlags
flags)
108
private Size GetUnconstrainedSize(string? text, Font? font,
TextFormatFlags
flags)
115
flags &= ~
TextFormatFlags
.WordBreak; // rip out the wordbreak flag
System\Windows\Forms\Rendering\ControlPaint.cs (18)
1981
TextFormatFlags
format)
1998
TextFormatFlags
format,
2502
internal static
TextFormatFlags
ConvertAlignmentToTextFormat(ContentAlignment alignment)
2505
TextFormatFlags
flags =
TextFormatFlags
.Top |
TextFormatFlags
.Left;
2509
flags |=
TextFormatFlags
.Bottom;
2513
flags |=
TextFormatFlags
.VerticalCenter;
2518
flags |=
TextFormatFlags
.Right;
2522
flags |=
TextFormatFlags
.HorizontalCenter;
2585
internal static
TextFormatFlags
CreateTextFormatFlags(
2592
TextFormatFlags
flags = ConvertAlignmentToTextFormat(alignment);
2597
flags |=
TextFormatFlags
.WordBreak |
TextFormatFlags
.TextBoxControl;
2601
flags |=
TextFormatFlags
.EndEllipsis;
2607
flags |=
TextFormatFlags
.RightToLeft;
2613
flags |=
TextFormatFlags
.NoPrefix;
2618
flags |=
TextFormatFlags
.HidePrefix;
System\Windows\Forms\Rendering\TextExtensions.cs (5)
25
private static (DRAW_TEXT_FORMAT Flags, TextPaddingOptions Padding) SplitTextFormatFlags(
TextFormatFlags
flags)
35
TextPaddingOptions padding = flags.HasFlag(
TextFormatFlags
.LeftAndRightPadding)
37
: flags.HasFlag(
TextFormatFlags
.NoPadding)
55
TextFormatFlags
flags,
215
TextFormatFlags
flags)
System\Windows\Forms\Rendering\TextRenderer.cs (49)
18
internal const
TextFormatFlags
SkipAssertFlag = (
TextFormatFlags
)0x4000_0000;
74
TextFormatFlags
flags)
86
/// <param name="flags">A bitwise combination of the <see cref="
TextFormatFlags
"/> values.</param>
89
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
97
TextFormatFlags
flags)
114
TextFormatFlags
flags)
127
/// <param name="flags">A bitwise combination of the <see cref="
TextFormatFlags
"/> values.</param>
130
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
139
TextFormatFlags
flags)
204
TextFormatFlags
flags)
216
/// <param name="flags">A bitwise combination of the <see cref="
TextFormatFlags
"/> values.</param>
219
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
227
TextFormatFlags
flags)
244
TextFormatFlags
flags)
257
/// <param name="flags">A bitwise combination of the <see cref="
TextFormatFlags
"/> values.</param>
260
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
269
TextFormatFlags
flags)
286
TextFormatFlags
flags =
TextFormatFlags
.Default)
296
TextFormatFlags
flags =
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter)
318
TextFormatFlags
flags)
328
TextFormatFlags
flags =
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter)
352
TextFormatFlags
flags)
363
TextFormatFlags
flags)
369
private static
TextFormatFlags
BlockModifyString(
TextFormatFlags
flags)
372
if (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
)"/>.
421
public static Size MeasureText(string? text, Font? font, Size proposedSize,
TextFormatFlags
flags)
437
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
439
public static Size MeasureText(ReadOnlySpan<char> text, Font? font, Size proposedSize,
TextFormatFlags
flags)
483
TextFormatFlags
flags)
501
/// Thrown if <see cref="
TextFormatFlags
.ModifyString"/> is set.
508
TextFormatFlags
flags)
515
TextFormatFlags
flags =
TextFormatFlags
.Bottom)
531
TextFormatFlags
flags =
TextFormatFlags
.Bottom)
602
internal static ApplyGraphicsProperties GetApplyStateFlags(IDeviceContext deviceContext,
TextFormatFlags
textFormatFlags)
610
if (textFormatFlags.HasFlag(
TextFormatFlags
.PreserveGraphicsClipping))
615
if (textFormatFlags.HasFlag(
TextFormatFlags
.PreserveGraphicsTranslateTransform))
System\Windows\Forms\ToolTip\DrawToolTipEventArgs.cs (5)
84
DrawText(
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter
85
|
TextFormatFlags
.SingleLine |
TextFormatFlags
.HidePrefix);
91
public void DrawText(
TextFormatFlags
flags)
System\Windows\Forms\VisualStyles\VisualStyleRenderer.cs (5)
365
DrawText(dc, bounds, textToDraw, drawDisabled,
TextFormatFlags
.HorizontalCenter);
371
public void DrawText(IDeviceContext dc, Rectangle bounds, string? textToDraw, bool drawDisabled,
TextFormatFlags
flags)
379
internal void DrawText(HDC dc, Rectangle bounds, string? textToDraw, bool drawDisabled,
TextFormatFlags
flags)
658
public unsafe Rectangle GetTextExtent(IDeviceContext dc, string textToDraw,
TextFormatFlags
flags)
681
public unsafe Rectangle GetTextExtent(IDeviceContext dc, Rectangle bounds, string textToDraw,
TextFormatFlags
flags)
System.Windows.Forms.Design (21)
System\ComponentModel\Design\CollectionEditor.SplitButton.cs (5)
197
TextFormatFlags
formatFlags =
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter;
224
formatFlags |=
TextFormatFlags
.NoPrefix;
228
formatFlags |=
TextFormatFlags
.HidePrefix;
System\Windows\Forms\Design\DesignBindingPicker.cs (6)
1857
TextFormatFlags
formatFlags =
1858
TextFormatFlags
.WordBreak |
1859
TextFormatFlags
.EndEllipsis |
1860
TextFormatFlags
.TextBoxControl |
1861
TextFormatFlags
.PreserveGraphicsClipping |
1862
TextFormatFlags
.PreserveGraphicsTranslateTransform;
System\Windows\Forms\Design\SplitterPanelDesigner.cs (2)
194
TextRenderer.DrawText(g, name, drawFont, new Point(watermarkX, watermarkY), waterMarkTextColor,
TextFormatFlags
.PreserveGraphicsClipping |
TextFormatFlags
.PreserveGraphicsTranslateTransform);
System\Windows\Forms\Design\ToolStripCollectionEditor.ToolStripItemEditorForm.cs (8)
784
TextFormatFlags
format =
TextFormatFlags
.Top |
TextFormatFlags
.Left;
906
TextFormatFlags
flags =
TextFormatFlags
.EndEllipsis |
TextFormatFlags
.PreserveGraphicsTranslateTransform |
TextFormatFlags
.PreserveGraphicsClipping;
909
flags |=
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)]
91
public void CheckBoxRenderer_DrawCheckBox_VisualStyleOn_OverloadWithTextFormat(
TextFormatFlags
textFormat, CheckBoxState cBState)
141
CheckBoxRenderer.DrawCheckBox(graphics, point, bounds, control.Text, SystemFonts.DefaultFont,
TextFormatFlags
.Default, focus, cBState, HWND.Null);
System\Windows\Forms\ControlPaintTests.cs (10)
1950
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.Default };
1951
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, Rectangle.Empty,
TextFormatFlags
.VerticalCenter };
1952
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, -3, -4),
TextFormatFlags
.VerticalCenter };
1953
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1954
yield return new object[] { s, SystemFonts.MenuFont, Color.Black, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1955
yield return new object[] { s, SystemFonts.MenuFont, Color.White, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1956
yield return new object[] { s, SystemFonts.MenuFont, Color.Transparent, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1957
yield return new object[] { s, SystemFonts.MenuFont, Color.Empty, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1965
Rectangle layoutRectangle,
TextFormatFlags
format)
1979
Assert.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)
5256
int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default);
5259
height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default, out bool widthTruncated);
5271
int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20,
TextFormatFlags
.Default);
5274
height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20,
TextFormatFlags
.Default, out bool widthTruncated);
5283
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default));
5284
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default, out widthTruncated));
5294
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10,
TextFormatFlags
.Default));
5295
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10,
TextFormatFlags
.Default, out widthTruncated));
5307
Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth,
TextFormatFlags
.Default));
5308
Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth,
TextFormatFlags
.Default, out widthTruncated));
5313
[InlineData((
TextFormatFlags
)(-1))]
5314
public void DataGridViewCell_MeasureTextHeight_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5330
Assert.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)]
5340
public void DataGridViewCell_MeasureTextPreferredSize_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5350
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextPreferredSize(null, "text", SystemFonts.DefaultFont, 0.2f,
TextFormatFlags
.Default));
5358
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", null, 0.2f,
TextFormatFlags
.Default));
5368
Assert.Throws<ArgumentOutOfRangeException>("maxRatio", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", SystemFonts.DefaultFont, maxRatio,
TextFormatFlags
.Default));
5372
[InlineData((
TextFormatFlags
)(-1))]
5373
public void DataGridViewCell_MeasureTextPreferredSize_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5386
Assert.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)]
5396
public void DataGridViewCell_MeasureTextSize_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5406
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextSize(null, "text", SystemFonts.DefaultFont,
TextFormatFlags
.Default));
5414
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextSize(graphics, "text", null,
TextFormatFlags
.Default));
5418
[InlineData((
TextFormatFlags
)(-1))]
5419
public void DataGridViewCell_MeasureTextSize_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5432
Assert.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)]
5442
public void DataGridViewCell_MeasureTextWidth_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5452
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextWidth(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default));
5460
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextWidth(graphics, "text", null, 10,
TextFormatFlags
.Default));
5470
Assert.Throws<ArgumentOutOfRangeException>("maxHeight", () => DataGridViewCell.MeasureTextWidth(graphics, "text", SystemFonts.DefaultFont, maxHeight,
TextFormatFlags
.Default));
5474
[InlineData((
TextFormatFlags
)(-1))]
5475
public void DataGridViewCell_MeasureTextWidth_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (2)
102
e.DrawText(
TextFormatFlags
.Bottom);
119
e.DrawText(
TextFormatFlags
.Left);
System\Windows\Forms\DrawListViewItemEventArgsTests.cs (1)
147
e.DrawText(
TextFormatFlags
.Bottom);
System\Windows\Forms\DrawToolTipEventArgsTests.cs (1)
72
e.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)]
85
public void RadioButtonRenderer_DrawRadioButton_OverloadWithTextFormat(
TextFormatFlags
textFormat,
135
TextFormatFlags
.Default,
System\Windows\Forms\TextRendererTests.cs (142)
86
yield return new object[] { hint, text, null, Point.Empty, Color.Red,
TextFormatFlags
.Default, };
87
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red,
TextFormatFlags
.Default, };
88
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black,
TextFormatFlags
.Default, };
89
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White,
TextFormatFlags
.Default, };
90
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent,
TextFormatFlags
.Default, };
91
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty,
TextFormatFlags
.Default, };
93
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.HorizontalCenter };
94
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
95
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
96
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.SingleLine };
97
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (
TextFormatFlags
)1024 };
98
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.RightToLeft };
99
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (
TextFormatFlags
)int.MaxValue };
106
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor,
TextFormatFlags
flags)
123
yield return new object[] { hint, text, null, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default, };
124
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
125
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, Color.Blue,
TextFormatFlags
.Default, };
126
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, Color.Blue,
TextFormatFlags
.Default, };
127
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, Color.Blue,
TextFormatFlags
.Default, };
128
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, Color.Blue,
TextFormatFlags
.Default, };
129
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Red,
TextFormatFlags
.Default, };
130
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Black,
TextFormatFlags
.Default, };
131
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.White,
TextFormatFlags
.Default, };
132
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Transparent,
TextFormatFlags
.Default, };
133
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Empty,
TextFormatFlags
.Default, };
135
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
136
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
137
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
138
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (
TextFormatFlags
)1024 };
139
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.RightToLeft };
140
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (
TextFormatFlags
)int.MaxValue };
147
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, Color backColor,
TextFormatFlags
flags)
232
yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red,
TextFormatFlags
.Default, };
233
yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red,
TextFormatFlags
.Default, };
234
yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red,
TextFormatFlags
.Default, };
235
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default, };
236
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black,
TextFormatFlags
.Default, };
237
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White,
TextFormatFlags
.Default, };
238
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent,
TextFormatFlags
.Default, };
239
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty,
TextFormatFlags
.Default, };
241
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.HorizontalCenter };
242
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
243
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
244
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.SingleLine };
245
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red,
TextFormatFlags
.SingleLine };
246
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (
TextFormatFlags
)1024 };
247
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.RightToLeft };
248
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (
TextFormatFlags
)int.MaxValue };
255
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor,
TextFormatFlags
flags)
272
yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default, };
273
yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
274
yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Blue, Color.Blue,
TextFormatFlags
.Default, };
275
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
276
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, Color.Blue,
TextFormatFlags
.Default, };
277
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, Color.Blue,
TextFormatFlags
.Default, };
278
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, Color.Blue,
TextFormatFlags
.Default, };
279
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, Color.Blue,
TextFormatFlags
.Default, };
280
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Red,
TextFormatFlags
.Default, };
281
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Black,
TextFormatFlags
.Default, };
282
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.White,
TextFormatFlags
.Default, };
283
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Transparent,
TextFormatFlags
.Default, };
284
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Empty,
TextFormatFlags
.Default, };
286
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
287
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
288
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
289
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
290
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (
TextFormatFlags
)1024 };
291
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.RightToLeft };
292
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (
TextFormatFlags
)int.MaxValue };
299
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, Color backColor,
TextFormatFlags
flags)
333
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Default);
337
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default);
345
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default);
353
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default);
365
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Default);
369
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default);
377
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default);
385
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default);
440
yield return new object[] { "string", null, Size.Empty,
TextFormatFlags
.Default };
441
yield return new object[] { "string", null, new Size(1, 2),
TextFormatFlags
.Default };
442
yield return new object[] { "string", null, new Size(100, 200),
TextFormatFlags
.Default };
443
yield return new object[] { "string", null, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.Default };
444
yield return new object[] { "string", SystemFonts.MenuFont, Size.Empty,
TextFormatFlags
.Default };
445
yield return new object[] { "string", SystemFonts.MenuFont, new Size(1, 2),
TextFormatFlags
.Default };
446
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.Default };
447
yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.Default };
449
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
450
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
451
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.SingleLine };
452
yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.SingleLine };
453
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (
TextFormatFlags
)1024 };
454
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.RightToLeft };
455
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (
TextFormatFlags
)int.MaxValue };
460
public void TextRenderer_MeasureText_InvokeStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize,
TextFormatFlags
flags)
502
public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize,
TextFormatFlags
flags)
523
Assert.Equal(Size.Empty, TextRenderer.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
526
Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
529
Assert.Equal(Size.Empty, TextRenderer.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
532
Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
558
TextRenderer.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default);
568
Assert.Throws<ArgumentNullException>("dc", () => TextRenderer.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
623
TextFormatFlags
.ModifyString),
631
TextFormatFlags
.ModifyString),
638
TextFormatFlags
.ModifyString),
646
TextFormatFlags
.ModifyString),
652
TextFormatFlags
.ModifyString),
657
TextFormatFlags
.ModifyString),
671
public unsafe void TextRenderer_DrawText_Padding_Point(
TextFormatFlags
flags, Rectangle expectedBounds)
694
public unsafe void TextRenderer_DrawText_Padding_Rectangle(
TextFormatFlags
flags, Rectangle expectedBounds)
715
public 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) }
725
public void TextRenderer_MeasureText_Padding(
TextFormatFlags
flags, Size expectedSize)
739
public 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) }
749
public void TextRenderer_DrawText_ApplyState(
TextFormatFlags
flags, Rectangle expectedBounds)
791
public 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) },
802
public void TextRenderer_MeasureText_ApplyState(
TextFormatFlags
flags, Size expectedSize)
826
public 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)
1227
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.None, 0, 0,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1228
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Image, 1, 0,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1229
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.ImageAndText, 1, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1231
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1232
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1233
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1234
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1235
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1236
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1237
yield return new object[] { ContentAlignment.TopRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1238
yield return new object[] { ContentAlignment.TopRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1239
yield return new object[] { ContentAlignment.TopRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1241
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1242
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1243
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1244
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1245
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1246
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1247
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1248
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1249
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1251
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1252
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1253
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1254
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1255
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1256
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1257
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1258
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1259
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1264
public void ToolStripButton_OnPaint_InvokeWithOwner_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount,
TextFormatFlags
expectedTextFormat)
1355
public void ToolStripButton_OnPaint_InvokeWithOwnerCantShowKeyboardCues_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount,
TextFormatFlags
expectedTextFormat)
System\Windows\Forms\ToolStripItemTextRenderEventArgsTests.cs (23)
14
yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null,
TextFormatFlags
.Top - 1 };
15
yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Top };
16
yield return new object[] { new ToolStripButton() { RightToLeft = RightToLeft.Yes }, "text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Bottom };
21
public void Ctor_ToolStripItem_String_Rectangle_Color_Font_TextFormatFlags(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont,
TextFormatFlags
format)
39
yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, ContentAlignment.TopLeft - 1,
TextFormatFlags
.Default |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
40
yield 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 };
41
yield 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 };
42
yield 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 };
47
public void Ctor_ToolStripItem_String_Rectangle_Color_Font_ContentAlignment(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign,
TextFormatFlags
expectedTextFormat)
68
Assert.Throws<ArgumentNullException>("item", () => new ToolStripItemTextRenderEventArgs(graphics, null, "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Top));
84
ToolStripItemTextRenderEventArgs e = new(graphics, new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Blue, SystemFonts.DefaultFont,
TextFormatFlags
.Top)
System\Windows\Forms\ToolStripRendererTests.cs (13)
296
yield return new object[] { new SubToolStripItem(), null, Rectangle.Empty, Color.Empty, null,
TextFormatFlags
.Left };
297
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 0, 4), Color.Empty, null,
TextFormatFlags
.Left };
298
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 0), Color.Empty, null,
TextFormatFlags
.Left };
299
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 4), Color.Empty, null,
TextFormatFlags
.Left };
301
yield return new object[] { new SubToolStripItem(), "Text", Rectangle.Empty, Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
302
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 0, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
303
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 0), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
304
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
305
yield return new object[] { new SubToolStripItem() { Enabled = false }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
306
yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical270 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
307
yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical90 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
312
public void ToolStripRenderer_DrawItemText_Invoke_CallsRenderItemText(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont,
TextFormatFlags
format)
841
public void ToolStripRenderer_OnRenderItemText_Invoke_Nop(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont,
TextFormatFlags
format)
System\Windows\Forms\VisualStyles\VisualStyleRendererTests.cs (12)
463
yield return new object[] { new Rectangle(1, 2, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
464
yield return new object[] { new Rectangle(0, 0, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.VerticalCenter };
465
yield return new object[] { new Rectangle(0, 0, 0, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
466
yield return new object[] { new Rectangle(0, 0, -1, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
467
yield return new object[] { new Rectangle(0, 0, 3, 0), textToDraw, drawDisabled,
TextFormatFlags
.Default };
468
yield return new object[] { new Rectangle(0, 0, 3, -1), textToDraw, drawDisabled,
TextFormatFlags
.Default };
469
yield return new object[] { new Rectangle(0, 0, 0, 0), textToDraw, drawDisabled,
TextFormatFlags
.Default };
470
yield return new object[] { new Rectangle(0, 0, -1, -1), textToDraw, drawDisabled,
TextFormatFlags
.Default };
471
yield return new object[] { new Rectangle(-1, -2, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
478
public void VisualStyleRenderer_DrawText_InvokeIDeviceContextRectangleStringBoolTextFormatFlags_Success(Rectangle bounds, string textToDraw, bool drawDisabled,
TextFormatFlags
flags)
496
Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", true,
TextFormatFlags
.Default));
497
Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", false,
TextFormatFlags
.Default));
Text\FontMetrics.cs (1)
87
Size measure = screen.HDC.MeasureText("Windows Foundation Classes", hfont, proposedSize, (
TextFormatFlags
)dt);
TextBoxBaseTests.cs (1)
5130
int width = TextRenderer.MeasureText(control.Text, control.Font, Size.Empty,
TextFormatFlags
.SingleLine).Width;