760 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)
3954
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;
1180
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
2319
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
2324
if ((flags &
TextFormatFlags
.SingleLine) != 0)
2326
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);
847
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(DataGridView.RightToLeftInternal, cellStyle.Alignment, cellStyle.WrapMode);
883
if ((flags &
TextFormatFlags
.SingleLine) != 0)
885
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);
729
TextFormatFlags
flags = DataGridViewUtilities.ComputeTextFormatFlagsForCellStyleAlignment(
738
if ((flags &
TextFormatFlags
.SingleLine) != 0)
740
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)
205
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)
1982
TextFormatFlags
format)
1999
TextFormatFlags
format,
2503
internal static
TextFormatFlags
ConvertAlignmentToTextFormat(ContentAlignment alignment)
2506
TextFormatFlags
flags =
TextFormatFlags
.Top |
TextFormatFlags
.Left;
2510
flags |=
TextFormatFlags
.Bottom;
2514
flags |=
TextFormatFlags
.VerticalCenter;
2519
flags |=
TextFormatFlags
.Right;
2523
flags |=
TextFormatFlags
.HorizontalCenter;
2586
internal static
TextFormatFlags
CreateTextFormatFlags(
2593
TextFormatFlags
flags = ConvertAlignmentToTextFormat(alignment);
2598
flags |=
TextFormatFlags
.WordBreak |
TextFormatFlags
.TextBoxControl;
2602
flags |=
TextFormatFlags
.EndEllipsis;
2608
flags |=
TextFormatFlags
.RightToLeft;
2614
flags |=
TextFormatFlags
.NoPrefix;
2619
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 (13)
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)
1855
TextFormatFlags
formatFlags =
1856
TextFormatFlags
.WordBreak |
1857
TextFormatFlags
.EndEllipsis |
1858
TextFormatFlags
.TextBoxControl |
1859
TextFormatFlags
.PreserveGraphicsClipping |
1860
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.Tests (376)
System\Windows\Forms\CheckBoxRendererTests.cs (7)
84
[InlineData(
TextFormatFlags
.Default, CheckBoxState.CheckedNormal)]
85
[InlineData(
TextFormatFlags
.Default, CheckBoxState.MixedNormal)]
86
[InlineData(
TextFormatFlags
.GlyphOverhangPadding, CheckBoxState.MixedHot)]
87
[InlineData(
TextFormatFlags
.PreserveGraphicsTranslateTransform, CheckBoxState.CheckedPressed)]
88
[InlineData(
TextFormatFlags
.TextBoxControl, CheckBoxState.UncheckedNormal)]
89
public void CheckBoxRenderer_DrawCheckBox_VisualStyleOn_OverloadWithTextFormat(
TextFormatFlags
textFormat, CheckBoxState cBState)
139
CheckBoxRenderer.DrawCheckBox(graphics, point, bounds, control.Text, SystemFonts.DefaultFont,
TextFormatFlags
.Default, focus, cBState, HWND.Null);
System\Windows\Forms\ControlPaintTests.cs (10)
1948
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.Default };
1949
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, Rectangle.Empty,
TextFormatFlags
.VerticalCenter };
1950
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, -3, -4),
TextFormatFlags
.VerticalCenter };
1951
yield return new object[] { s, SystemFonts.MenuFont, Color.Red, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1952
yield return new object[] { s, SystemFonts.MenuFont, Color.Black, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1953
yield return new object[] { s, SystemFonts.MenuFont, Color.White, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1954
yield return new object[] { s, SystemFonts.MenuFont, Color.Transparent, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1955
yield return new object[] { s, SystemFonts.MenuFont, Color.Empty, new Rectangle(1, 2, 3, 4),
TextFormatFlags
.VerticalCenter };
1963
Rectangle layoutRectangle,
TextFormatFlags
format)
1977
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)
5254
int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default);
5257
height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default, out bool widthTruncated);
5269
int height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20,
TextFormatFlags
.Default);
5272
height = DataGridViewCell.MeasureTextHeight(graphics, text, SystemFonts.DefaultFont, 20,
TextFormatFlags
.Default, out bool widthTruncated);
5281
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default));
5282
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextHeight(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default, out widthTruncated));
5292
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10,
TextFormatFlags
.Default));
5293
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextHeight(graphics, "text", null, 10,
TextFormatFlags
.Default, out widthTruncated));
5305
Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth,
TextFormatFlags
.Default));
5306
Assert.Throws<ArgumentOutOfRangeException>("maxWidth", () => DataGridViewCell.MeasureTextHeight(graphics, "text", SystemFonts.DefaultFont, maxWidth,
TextFormatFlags
.Default, out widthTruncated));
5311
[InlineData((
TextFormatFlags
)(-1))]
5312
public void DataGridViewCell_MeasureTextHeight_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5328
Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextPreferredSize(graphics, text, SystemFonts.DefaultFont, 0.2f,
TextFormatFlags
.Default));
5332
[InlineData("a",
TextFormatFlags
.Default)]
5333
[InlineData("truncate_me",
TextFormatFlags
.Default)]
5334
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default)]
5335
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5336
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default)]
5337
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5338
public void DataGridViewCell_MeasureTextPreferredSize_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5348
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextPreferredSize(null, "text", SystemFonts.DefaultFont, 0.2f,
TextFormatFlags
.Default));
5356
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", null, 0.2f,
TextFormatFlags
.Default));
5366
Assert.Throws<ArgumentOutOfRangeException>("maxRatio", () => DataGridViewCell.MeasureTextPreferredSize(graphics, "text", SystemFonts.DefaultFont, maxRatio,
TextFormatFlags
.Default));
5370
[InlineData((
TextFormatFlags
)(-1))]
5371
public void DataGridViewCell_MeasureTextPreferredSize_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5384
Assert.Equal(Size.Empty, DataGridViewCell.MeasureTextSize(graphics, text, SystemFonts.DefaultFont,
TextFormatFlags
.Default));
5388
[InlineData("a",
TextFormatFlags
.Default)]
5389
[InlineData("truncate_me",
TextFormatFlags
.Default)]
5390
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default)]
5391
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5392
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default)]
5393
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5394
public void DataGridViewCell_MeasureTextSize_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5404
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextSize(null, "text", SystemFonts.DefaultFont,
TextFormatFlags
.Default));
5412
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextSize(graphics, "text", null,
TextFormatFlags
.Default));
5416
[InlineData((
TextFormatFlags
)(-1))]
5417
public void DataGridViewCell_MeasureTextSize_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
5430
Assert.Equal(0, DataGridViewCell.MeasureTextWidth(graphics, text, SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default));
5434
[InlineData("a",
TextFormatFlags
.Default)]
5435
[InlineData("truncate_me",
TextFormatFlags
.Default)]
5436
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default)]
5437
[InlineData("truncate_me\r\nnew\rn\nnew",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5438
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default)]
5439
[InlineData("truncate_me\r\truncate_me_again",
TextFormatFlags
.Default |
TextFormatFlags
.SingleLine)]
5440
public void DataGridViewCell_MeasureTextWidth_NonEmptyText_ReturnsExpected(string text,
TextFormatFlags
flags)
5450
Assert.Throws<ArgumentNullException>("graphics", () => DataGridViewCell.MeasureTextWidth(null, "text", SystemFonts.DefaultFont, 10,
TextFormatFlags
.Default));
5458
Assert.Throws<ArgumentNullException>("font", () => DataGridViewCell.MeasureTextWidth(graphics, "text", null, 10,
TextFormatFlags
.Default));
5468
Assert.Throws<ArgumentOutOfRangeException>("maxHeight", () => DataGridViewCell.MeasureTextWidth(graphics, "text", SystemFonts.DefaultFont, maxHeight,
TextFormatFlags
.Default));
5472
[InlineData((
TextFormatFlags
)(-1))]
5473
public void DataGridViewCell_MeasureTextWidth_InvalidFlags_ThrowsInvalidEnumArgumentException(
TextFormatFlags
flags)
System\Windows\Forms\DrawListViewColumnHeaderEventArgsTests.cs (2)
100
e.DrawText(
TextFormatFlags
.Bottom);
117
e.DrawText(
TextFormatFlags
.Left);
System\Windows\Forms\DrawListViewItemEventArgsTests.cs (1)
145
e.DrawText(
TextFormatFlags
.Bottom);
System\Windows\Forms\DrawToolTipEventArgsTests.cs (1)
70
e.DrawText(
TextFormatFlags
.Bottom);
System\Windows\Forms\RadioButtonRendererTests.cs (6)
78
[InlineData(
TextFormatFlags
.Default, RadioButtonState.CheckedNormal)]
79
[InlineData(
TextFormatFlags
.Default, RadioButtonState.CheckedPressed)]
80
[InlineData(
TextFormatFlags
.PreserveGraphicsTranslateTransform, RadioButtonState.CheckedPressed)]
81
[InlineData(
TextFormatFlags
.TextBoxControl, RadioButtonState.UncheckedNormal)]
82
public void RadioButtonRenderer_DrawRadioButton_OverloadWithTextFormat(
TextFormatFlags
textFormat,
124
TextFormatFlags
.Default,
System\Windows\Forms\TextRendererTests.cs (142)
84
yield return new object[] { hint, text, null, Point.Empty, Color.Red,
TextFormatFlags
.Default, };
85
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red,
TextFormatFlags
.Default, };
86
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black,
TextFormatFlags
.Default, };
87
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White,
TextFormatFlags
.Default, };
88
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent,
TextFormatFlags
.Default, };
89
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty,
TextFormatFlags
.Default, };
91
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.HorizontalCenter };
92
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
93
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
94
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.SingleLine };
95
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (
TextFormatFlags
)1024 };
96
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.RightToLeft };
97
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, (
TextFormatFlags
)int.MaxValue };
104
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor,
TextFormatFlags
flags)
121
yield return new object[] { hint, text, null, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default, };
122
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
123
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Black, Color.Blue,
TextFormatFlags
.Default, };
124
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.White, Color.Blue,
TextFormatFlags
.Default, };
125
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Transparent, Color.Blue,
TextFormatFlags
.Default, };
126
yield return new object[] { hint, text, SystemFonts.MenuFont, new Point(1, 2), Color.Empty, Color.Blue,
TextFormatFlags
.Default, };
127
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Red,
TextFormatFlags
.Default, };
128
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Black,
TextFormatFlags
.Default, };
129
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.White,
TextFormatFlags
.Default, };
130
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Transparent,
TextFormatFlags
.Default, };
131
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Empty,
TextFormatFlags
.Default, };
133
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
134
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
135
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
136
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (
TextFormatFlags
)1024 };
137
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.RightToLeft };
138
yield return new object[] { hint, text, SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue, (
TextFormatFlags
)int.MaxValue };
145
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontPointColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Point pt, Color foreColor, Color backColor,
TextFormatFlags
flags)
230
yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red,
TextFormatFlags
.Default, };
231
yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red,
TextFormatFlags
.Default, };
232
yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red,
TextFormatFlags
.Default, };
233
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default, };
234
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black,
TextFormatFlags
.Default, };
235
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White,
TextFormatFlags
.Default, };
236
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent,
TextFormatFlags
.Default, };
237
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty,
TextFormatFlags
.Default, };
239
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.HorizontalCenter };
240
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
241
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
242
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.SingleLine };
243
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red,
TextFormatFlags
.SingleLine };
244
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (
TextFormatFlags
)1024 };
245
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.RightToLeft };
246
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, (
TextFormatFlags
)int.MaxValue };
253
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor,
TextFormatFlags
flags)
270
yield return new object[] { hint, text, null, Rectangle.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default, };
271
yield return new object[] { hint, text, null, new Rectangle(1, 2, -3, -4), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
272
yield return new object[] { hint, text, null, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Blue, Color.Blue,
TextFormatFlags
.Default, };
273
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default, };
274
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Black, Color.Blue,
TextFormatFlags
.Default, };
275
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.White, Color.Blue,
TextFormatFlags
.Default, };
276
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Transparent, Color.Blue,
TextFormatFlags
.Default, };
277
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Empty, Color.Blue,
TextFormatFlags
.Default, };
278
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Red,
TextFormatFlags
.Default, };
279
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Black,
TextFormatFlags
.Default, };
280
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.White,
TextFormatFlags
.Default, };
281
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Transparent,
TextFormatFlags
.Default, };
282
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Empty,
TextFormatFlags
.Default, };
284
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
285
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
286
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
287
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, int.MaxValue, int.MaxValue), Color.Red, Color.Blue,
TextFormatFlags
.SingleLine };
288
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (
TextFormatFlags
)1024 };
289
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.RightToLeft };
290
yield return new object[] { hint, text, SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, (
TextFormatFlags
)int.MaxValue };
297
public void TextRenderer_DrawText_InvokeIDeviceContextStringFontRectangleColorColorTextFormatFlags_Success(TextRenderingHint textRenderingHint, string text, Font font, Rectangle rectangle, Color foreColor, Color backColor,
TextFormatFlags
flags)
331
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Default);
335
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default);
343
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default);
351
TextRenderer.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default);
363
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red,
TextFormatFlags
.Default);
367
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue,
TextFormatFlags
.Default);
375
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red,
TextFormatFlags
.Default);
383
TextRenderer.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue,
TextFormatFlags
.Default);
438
yield return new object[] { "string", null, Size.Empty,
TextFormatFlags
.Default };
439
yield return new object[] { "string", null, new Size(1, 2),
TextFormatFlags
.Default };
440
yield return new object[] { "string", null, new Size(100, 200),
TextFormatFlags
.Default };
441
yield return new object[] { "string", null, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.Default };
442
yield return new object[] { "string", SystemFonts.MenuFont, Size.Empty,
TextFormatFlags
.Default };
443
yield return new object[] { "string", SystemFonts.MenuFont, new Size(1, 2),
TextFormatFlags
.Default };
444
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.Default };
445
yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.Default };
447
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HorizontalCenter };
448
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.Bottom |
TextFormatFlags
.Right };
449
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.SingleLine };
450
yield return new object[] { "string", SystemFonts.MenuFont, new Size(int.MaxValue, int.MaxValue),
TextFormatFlags
.SingleLine };
451
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (
TextFormatFlags
)1024 };
452
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200),
TextFormatFlags
.RightToLeft };
453
yield return new object[] { "string", SystemFonts.MenuFont, new Size(100, 200), (
TextFormatFlags
)int.MaxValue };
458
public void TextRenderer_MeasureText_InvokeStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize,
TextFormatFlags
flags)
500
public void TextRenderer_MeasureText_InvokeIDeviceContextStringFontSizeTextFormatFlags_ReturnsExpected(string text, Font font, Size proposedSize,
TextFormatFlags
flags)
521
Assert.Equal(Size.Empty, TextRenderer.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
524
Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
527
Assert.Equal(Size.Empty, TextRenderer.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
530
Assert.Equal(Size.Empty, TextRenderer.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
556
TextRenderer.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default);
566
Assert.Throws<ArgumentNullException>("dc", () => TextRenderer.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400),
TextFormatFlags
.Default));
621
TextFormatFlags
.ModifyString),
629
TextFormatFlags
.ModifyString),
636
TextFormatFlags
.ModifyString),
644
TextFormatFlags
.ModifyString),
650
TextFormatFlags
.ModifyString),
655
TextFormatFlags
.ModifyString),
669
public unsafe void TextRenderer_DrawText_Padding_Point(
TextFormatFlags
flags, Rectangle expectedBounds)
692
public unsafe void TextRenderer_DrawText_Padding_Rectangle(
TextFormatFlags
flags, Rectangle expectedBounds)
713
public static TheoryData<
TextFormatFlags
, Rectangle> TextRenderer_DrawText_Padding_TestData
716
{
TextFormatFlags
.GlyphOverhangPadding, new Rectangle(3, 0, 70, 12) },
717
{
TextFormatFlags
.LeftAndRightPadding, new Rectangle(5, 0, 70, 12) },
718
{
TextFormatFlags
.NoPadding, new Rectangle(0, 0, 70, 12) }
723
public void TextRenderer_MeasureText_Padding(
TextFormatFlags
flags, Size expectedSize)
737
public static TheoryData<
TextFormatFlags
, Size> TextRenderer_MeasureText_Padding_TestData
740
{
TextFormatFlags
.GlyphOverhangPadding, new Size(78, 13) },
741
{
TextFormatFlags
.LeftAndRightPadding, new Size(82, 13) },
742
{
TextFormatFlags
.NoPadding, new Size(71, 13) }
747
public void TextRenderer_DrawText_ApplyState(
TextFormatFlags
flags, Rectangle expectedBounds)
789
public static TheoryData<
TextFormatFlags
, Rectangle> TextRenderer_DrawText_ApplyState_TestData
792
{
TextFormatFlags
.Default, new Rectangle(3, 0, 49, 12) },
793
{
TextFormatFlags
.PreserveGraphicsTranslateTransform, new Rectangle(8, 10, 49, 12) },
794
{
TextFormatFlags
.PreserveGraphicsClipping, new Rectangle(6, 12, 5, 0) },
795
{
TextFormatFlags
.PreserveGraphicsClipping |
TextFormatFlags
.PreserveGraphicsTranslateTransform, new Rectangle(8, 12, 3, 7) },
800
public void TextRenderer_MeasureText_ApplyState(
TextFormatFlags
flags, Size expectedSize)
824
public static TheoryData<
TextFormatFlags
, Size> TextRenderer_MeasureText_ApplyState_TestData
829
{
TextFormatFlags
.Default, new Size(57, 13) },
830
{
TextFormatFlags
.PreserveGraphicsTranslateTransform, new Size(57, 13) },
831
{
TextFormatFlags
.PreserveGraphicsClipping, new Size(57, 13) },
832
{
TextFormatFlags
.PreserveGraphicsClipping |
TextFormatFlags
.PreserveGraphicsTranslateTransform, new Size(57, 13) },
System\Windows\Forms\ToolStripButtonTests.cs (101)
1225
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.None, 0, 0,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1226
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Image, 1, 0,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1227
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.ImageAndText, 1, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1229
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1230
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1231
yield return new object[] { ContentAlignment.TopLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1232
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1233
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1234
yield return new object[] { ContentAlignment.TopCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1235
yield return new object[] { ContentAlignment.TopRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1236
yield return new object[] { ContentAlignment.TopRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1237
yield return new object[] { ContentAlignment.TopRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
1239
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1240
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1241
yield return new object[] { ContentAlignment.MiddleLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1242
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1243
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1244
yield return new object[] { ContentAlignment.MiddleCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1245
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1246
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1247
yield return new object[] { ContentAlignment.MiddleRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.VerticalCenter |
TextFormatFlags
.HidePrefix };
1249
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1250
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1251
yield return new object[] { ContentAlignment.BottomLeft, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Left |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1252
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1253
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1254
yield return new object[] { ContentAlignment.BottomCenter, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.HorizontalCenter |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1255
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Yes, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix |
TextFormatFlags
.RightToLeft };
1256
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.Inherit, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1257
yield return new object[] { ContentAlignment.BottomRight, RightToLeft.No, ToolStripItemDisplayStyle.Text, 0, 1,
TextFormatFlags
.Right |
TextFormatFlags
.Bottom |
TextFormatFlags
.HidePrefix };
1262
public void ToolStripButton_OnPaint_InvokeWithOwner_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount,
TextFormatFlags
expectedTextFormat)
1353
public void ToolStripButton_OnPaint_InvokeWithOwnerCantShowKeyboardCues_DoesNotCallPaint(ContentAlignment textAlign, RightToLeft rightToLeft, ToolStripItemDisplayStyle displayStyle, int expectedRenderItemImageCallCount, int expectedRenderItemTextCallCount,
TextFormatFlags
expectedTextFormat)
System\Windows\Forms\ToolStripItemTextRenderEventArgsTests.cs (23)
12
yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null,
TextFormatFlags
.Top - 1 };
13
yield return new object[] { new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Top };
14
yield return new object[] { new ToolStripButton() { RightToLeft = RightToLeft.Yes }, "text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Bottom };
19
public void Ctor_ToolStripItem_String_Rectangle_Color_Font_TextFormatFlags(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont,
TextFormatFlags
format)
37
yield return new object[] { new ToolStripButton(), null, Rectangle.Empty, Color.Empty, null, ContentAlignment.TopLeft - 1,
TextFormatFlags
.Default |
TextFormatFlags
.Top |
TextFormatFlags
.HidePrefix };
38
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 };
39
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 };
40
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 };
45
public void Ctor_ToolStripItem_String_Rectangle_Color_Font_ContentAlignment(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont, ContentAlignment textAlign,
TextFormatFlags
expectedTextFormat)
66
Assert.Throws<ArgumentNullException>("item", () => new ToolStripItemTextRenderEventArgs(graphics, null, "", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.DefaultFont,
TextFormatFlags
.Top));
82
ToolStripItemTextRenderEventArgs e = new(graphics, new ToolStripButton(), "", new Rectangle(1, 2, 3, 4), Color.Blue, SystemFonts.DefaultFont,
TextFormatFlags
.Top)
System\Windows\Forms\ToolStripRendererTests.cs (13)
294
yield return new object[] { new SubToolStripItem(), null, Rectangle.Empty, Color.Empty, null,
TextFormatFlags
.Left };
295
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 0, 4), Color.Empty, null,
TextFormatFlags
.Left };
296
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 0), Color.Empty, null,
TextFormatFlags
.Left };
297
yield return new object[] { new SubToolStripItem(), null, new Rectangle(1, 2, 3, 4), Color.Empty, null,
TextFormatFlags
.Left };
299
yield return new object[] { new SubToolStripItem(), "Text", Rectangle.Empty, Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
300
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 0, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
301
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 0), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
302
yield return new object[] { new SubToolStripItem(), "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
303
yield return new object[] { new SubToolStripItem() { Enabled = false }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
304
yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical270 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
305
yield return new object[] { new SubToolStripItem() { TextDirection = ToolStripTextDirection.Vertical90 }, "Text", new Rectangle(1, 2, 3, 4), Color.Red, SystemFonts.MenuFont,
TextFormatFlags
.Left };
310
public void ToolStripRenderer_DrawItemText_Invoke_CallsRenderItemText(ToolStripItem item, string text, Rectangle textRectangle, Color textColor, Font textFont,
TextFormatFlags
format)
839
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)
461
yield return new object[] { new Rectangle(1, 2, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
462
yield return new object[] { new Rectangle(0, 0, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.VerticalCenter };
463
yield return new object[] { new Rectangle(0, 0, 0, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
464
yield return new object[] { new Rectangle(0, 0, -1, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
465
yield return new object[] { new Rectangle(0, 0, 3, 0), textToDraw, drawDisabled,
TextFormatFlags
.Default };
466
yield return new object[] { new Rectangle(0, 0, 3, -1), textToDraw, drawDisabled,
TextFormatFlags
.Default };
467
yield return new object[] { new Rectangle(0, 0, 0, 0), textToDraw, drawDisabled,
TextFormatFlags
.Default };
468
yield return new object[] { new Rectangle(0, 0, -1, -1), textToDraw, drawDisabled,
TextFormatFlags
.Default };
469
yield return new object[] { new Rectangle(-1, -2, 3, 4), textToDraw, drawDisabled,
TextFormatFlags
.Default };
476
public void VisualStyleRenderer_DrawText_InvokeIDeviceContextRectangleStringBoolTextFormatFlags_Success(Rectangle bounds, string textToDraw, bool drawDisabled,
TextFormatFlags
flags)
494
Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", true,
TextFormatFlags
.Default));
495
Assert.Throws<ArgumentNullException>("dc", () => renderer.DrawText(null, new Rectangle(1, 2, 3, 4), "text", false,
TextFormatFlags
.Default));
Text\FontMetrics.cs (1)
85
Size measure = screen.HDC.MeasureText("Windows Foundation Classes", hfont, proposedSize, (
TextFormatFlags
)dt);
TextBoxBaseTests.cs (1)
5128
int width = TextRenderer.MeasureText(control.Text, control.Font, Size.Empty,
TextFormatFlags
.SingleLine).Width;