187 references to TextRenderer
System.Windows.Forms (86)
System\Windows\Forms\Controls\Buttons\Button.cs (1)
96
Size requiredSize =
TextRenderer
.MeasureText(Text, Font);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (5)
92
/// Get <see cref="TextFormatFlags"/> for rendering text using GDI (<see cref="
TextRenderer
"/>).
496
TextRenderer
.DrawTextInternal(e, Control.Text, Control.Font, r, colors.ButtonShadow, formatFlags);
501
TextRenderer
.DrawTextInternal(e, Control.Text, Control.Font, r, colors.Highlight, formatFlags);
504
TextRenderer
.DrawTextInternal(e, Control.Text, Control.Font, r, colors.ButtonShadow, formatFlags);
509
TextRenderer
.DrawTextInternal(e, Control.Text, Control.Font, r, color, formatFlags);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.LayoutOptions.cs (1)
677
textSize =
TextRenderer
.MeasureText(Text, Font, proposedSize, TextFormatFlags);
System\Windows\Forms\Controls\Buttons\ButtonRenderer.cs (2)
162
TextRenderer
.DrawText(g, buttonText, font, contentBounds, textColor, flags);
273
TextRenderer
.DrawText(deviceContext, buttonText, font, contentBounds, textColor, flags);
System\Windows\Forms\Controls\Buttons\CheckBox.cs (1)
283
Size textSize =
TextRenderer
.MeasureText(Text, Font);
System\Windows\Forms\Controls\Buttons\CheckBoxRenderer.cs (2)
147
TextRenderer
.DrawText(g, checkBoxText, font, textBounds, textColor, flags);
219
TextRenderer
.DrawText(g, checkBoxText, font, textBounds, textColor, flags);
System\Windows\Forms\Controls\Buttons\RadioButton.cs (1)
254
Size textSize =
TextRenderer
.MeasureText(Text, Font);
System\Windows\Forms\Controls\Buttons\RadioButtonRenderer.cs (2)
147
TextRenderer
.DrawText(g, radioButtonText, font, textBounds, textColor, flags);
240
TextRenderer
.DrawText(g, radioButtonText, font, textBounds, textColor, 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 (1)
92
TextRenderer
.DrawText(g, comboBoxText, font, textBounds, textColor, flags);
System\Windows\Forms\Controls\DataGridView\DataGridViewButtonCell.cs (1)
992
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewCell.cs (4)
2552
Size requiredSize =
TextRenderer
.MeasureText(text, font, new Size(maxWidth, int.MaxValue), flags);
2591
textSize =
TextRenderer
.MeasureText(text, font, new Size((int)maxWidth, int.MaxValue), flags);
2620
return
TextRenderer
.MeasureText(text, font, new Size(int.MaxValue, int.MaxValue), flags);
2647
textSize =
TextRenderer
.MeasureText(text, font, new Size((int)maxWidth, maxHeight), flags);
System\Windows\Forms\Controls\DataGridView\DataGridViewColumnHeaderCell.cs (1)
976
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewComboBoxCell.cs (2)
606
Size preferredSize =
TextRenderer
.MeasureText(comboBox.GetItemText(item), comboBox.Font);
2339
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewLinkCell.cs (1)
1027
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewRowHeaderCell.cs (1)
888
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewTextBoxCell.cs (1)
743
TextRenderer
.DrawText(graphics,
System\Windows\Forms\Controls\DataGridView\DataGridViewTopLeftHeaderCell.cs (1)
328
TextRenderer
.DrawText(
System\Windows\Forms\Controls\DataGridView\DataGridViewUtilities.cs (2)
322
Size sizeRequired =
TextRenderer
.MeasureText(text, font, new Size(int.MaxValue, int.MaxValue), flags);
330
Size sizeConstraint =
TextRenderer
.MeasureText(text, font, sizeCell, flags);
System\Windows\Forms\Controls\GroupBox\GroupBox.cs (1)
430
Color textColor = Enabled ? ForeColor :
TextRenderer
.DisabledTextColor(BackColor);
System\Windows\Forms\Controls\GroupBox\GroupBoxRenderer.cs (4)
181
Size measuredBounds =
TextRenderer
.MeasureText(
202
TextRenderer
.DrawText(deviceContext, groupBoxText, font, textBounds, textColor, flags);
284
Size measuredBounds =
TextRenderer
.MeasureText(
303
TextRenderer
.DrawText(deviceContext, groupBoxText, font, textBounds, textColor, flags);
System\Windows\Forms\Controls\Labels\Label.cs (3)
1299
TextRenderer
.DrawTextInternal(e, Text, Font, face, color, flags: flags);
1306
Color disabledTextForeColor =
TextRenderer
.DisabledTextColor(BackColor);
1307
TextRenderer
.DrawTextInternal(e, Text, Font, face, disabledTextForeColor, flags: flags);
System\Windows\Forms\Controls\Labels\LinkLabel.cs (4)
559
Size textSize =
TextRenderer
.MeasureText(text, alwaysUnderlined, clientSize, flags);
1302
TextRenderer
.DrawText(
1311
|
TextRenderer
.SkipAssertFlag
1365
TextRenderer
.DrawText(
System\Windows\Forms\Controls\ListBoxes\CheckedListBox.cs (1)
702
TextRenderer
.DrawText(e, text, font, stringBounds, foreColor, flags);
System\Windows\Forms\Controls\ListView\DrawListViewColumnHeaderEventArgs.cs (2)
142
int padding =
TextRenderer
.MeasureText(" ", Font).Width;
145
TextRenderer
.DrawText(Graphics, text, Font, newBounds, ForeColor, flags);
System\Windows\Forms\Controls\ListView\DrawListViewItemEventArgs.cs (2)
91
TextRenderer
.DrawText(Graphics, Item.Text, Item.Font, UpdateBounds(Bounds, drawText: true), Item.ForeColor, flags);
104
Size textSize =
TextRenderer
.MeasureText(subItem.Text, subItem.Font);
System\Windows\Forms\Controls\ListView\DrawListViewSubItemEventArgs.cs (2)
140
int padding =
TextRenderer
.MeasureText(" ", font).Width;
143
TextRenderer
.DrawText(Graphics, text, font, newBounds, color, flags);
System\Windows\Forms\Controls\ListView\ListViewItem.IKeyboardToolTip.cs (3)
114
new Size(Math.Min(
TextRenderer
.MeasureText(item.Text, item.Font).Width, itemBounds.Width),
123
int textWidth =
TextRenderer
.MeasureText(item.Text, item.Font).Width;
128
textWidth = Math.Max(
TextRenderer
.MeasureText(subItem.Text, subItem.Font).Width, textWidth);
System\Windows\Forms\Controls\PropertyGrid\PropertyGrid.MeasureTextHelper.cs (2)
24
:
TextRenderer
.MeasureText(
34
:
TextRenderer
.MeasureText(
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\GridEntry.cs (2)
1608
TextRenderer
.DrawText(g, label, font, textRect, textColor, PropertyGrid.MeasureTextHelper.GetTextRendererFlags());
1937
TextRenderer
.DrawTextInternal(
System\Windows\Forms\Controls\TabControl\TabRenderer.cs (2)
80
TextRenderer
.DrawText(g, tabItemText, font, contentBounds, textColor, flags);
131
TextRenderer
.DrawText(g, tabItemText, font, contentBounds, textColor, flags);
System\Windows\Forms\Controls\TextBox\TextBox.cs (2)
910
TextRenderer
.DrawTextInternal(hdc, PlaceholderText, Font, rectangle, SystemColors.GrayText,
TextRenderer
.DefaultQuality, flags);
System\Windows\Forms\Controls\TextBox\TextBoxBase.cs (1)
850
Size textSize =
TextRenderer
.MeasureText(Text, Font, proposedConstraints, format);
System\Windows\Forms\Controls\TextBox\TextBoxRenderer.cs (1)
84
TextRenderer
.DrawText(g, textBoxText, font, textBounds, textColor, flags);
System\Windows\Forms\Controls\ToolStrips\ToolStripDropDownMenu.cs (1)
295
_tabWidth =
TextRenderer
.MeasureText("\t", Font).Width;
System\Windows\Forms\Controls\ToolStrips\ToolStripItem.cs (1)
2359
_cachedTextSize =
TextRenderer
.MeasureText(Text, Font);
System\Windows\Forms\Controls\ToolStrips\ToolStripMenuItem.cs (1)
734
_cachedShortcutSize =
TextRenderer
.MeasureText(shortcutString, Font);
System\Windows\Forms\Controls\ToolStrips\ToolStripRenderer.cs (2)
882
TextRenderer
.DrawText(textGraphics, text, textFont, new Rectangle(Point.Empty, textSize), textColor, textFormat);
888
TextRenderer
.DrawText(g, text, textFont, textRect, textColor, textFormat);
System\Windows\Forms\Controls\TreeView\TreeView.cs (3)
2828
Size textSize =
TextRenderer
.MeasureText(node.Text, node.TreeView!.Font);
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\Controls\UpDown\NumericUpDown.cs (3)
813
int textWidth =
TextRenderer
.MeasureText(GetNumberText(testNumber), Font).Width;
821
int shortTextWidth =
TextRenderer
.MeasureText(shortText, Font).Width;
850
Size digitSize =
TextRenderer
.MeasureText(charSpan, Font);
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 (2)
78
Size prefSize =
TextRenderer
.MeasureText(text, font, proposedConstraints, flags);
116
_unconstrainedPreferredSize =
TextRenderer
.MeasureText(text, font, s_maxSize, flags);
System\Windows\Forms\Rendering\ControlPaint.cs (5)
1987
FONT_QUALITY quality =
TextRenderer
.FontQualityFromTextRenderingHint(dc);
1989
using DeviceContextHdcScope hdc = dc.ToHdcScope(
TextRenderer
.GetApplyStateFlags(dc, format));
2004
TextRenderer
.DrawTextInternal(dc, s, font, layoutRectangle, SystemColors.GrayText, quality, format);
2011
TextRenderer
.DrawTextInternal(dc, s, font, layoutRectangle, paintcolor, quality, format);
2014
TextRenderer
.DrawTextInternal(dc, s, font, layoutRectangle, paintcolor, quality, format);
System\Windows\Forms\Rendering\TextRenderer.cs (1)
394
/// <see cref="
TextRenderer
"/> is to add padding to the bounding rectangle of the drawn text to accommodate
System\Windows\Forms\ToolTip\DrawToolTipEventArgs.cs (1)
93
TextRenderer
.DrawText(Graphics, ToolTipText, Font, Bounds, _foreColor, flags);
System.Windows.Forms.Design (5)
System\ComponentModel\Design\CollectionEditor.SplitButton.cs (2)
62
if (_showSplit && !string.IsNullOrEmpty(Text) &&
TextRenderer
.MeasureText(Text, Font).Width + PushButtonWidth > preferredSize.Width)
233
TextRenderer
.DrawText(pevent, Text, Font, bounds, SystemColors.ControlText, formatFlags);
System\Windows\Forms\Design\DataGridViewColumnCollectionDialog.cs (1)
1162
int itemWidth =
TextRenderer
.MeasureText(_selectedColumns.Items[i].ToString(), _selectedColumns.Font).Width;
System\Windows\Forms\Design\DesignBindingPicker.cs (1)
1863
TextRenderer
.DrawText(e.Graphics, Text, Font, rect, ForeColor, formatFlags);
System\Windows\Forms\Design\SplitterPanelDesigner.cs (1)
194
TextRenderer
.DrawText(g, name, drawFont, new Point(watermarkX, watermarkY), waterMarkTextColor, TextFormatFlags.PreserveGraphicsClipping | TextFormatFlags.PreserveGraphicsTranslateTransform);
System.Windows.Forms.Tests (96)
System\Windows\Forms\ButtonTests.cs (13)
599
Size newSize =
TextRenderer
.MeasureText(control.Text, control.Font);
696
Size oldSize =
TextRenderer
.MeasureText(control.Text, control.Font);
700
Size newSize =
TextRenderer
.MeasureText(control.Text, font);
951
Size oldSize =
TextRenderer
.MeasureText(control.Text, control.Font);
955
Size newSize =
TextRenderer
.MeasureText("NewText", control.Font);
1338
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1362
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1634
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1658
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1682
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1706
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1730
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
1754
Size minSize =
TextRenderer
.MeasureText(control.Text, control.Font);
System\Windows\Forms\ListViewItem.IKeyboardToolTipTests.cs (2)
184
?
TextRenderer
.MeasureText(listViewItem.Text, listViewItem.Font).Width
200
?
TextRenderer
.MeasureText(listViewSubItem.Text, listViewSubItem.Font).Width
System\Windows\Forms\TextRendererTests.cs (78)
38
TextRenderer
.DrawText(graphics, text, font, pt, foreColor);
41
TextRenderer
.DrawText(graphics, text, font, pt, foreColor);
72
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, backColor);
75
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, backColor);
109
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, flags);
112
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, flags);
150
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, backColor, flags);
153
TextRenderer
.DrawText(graphics, text, font, pt, foreColor, backColor, flags);
182
TextRenderer
.DrawText(graphics, text, font, bounds, foreColor);
185
TextRenderer
.DrawText(graphics, text, font, bounds, foreColor);
218
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, backColor);
221
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, backColor);
258
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, flags);
261
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, flags);
302
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, backColor, flags);
305
TextRenderer
.DrawText(graphics, text, font, rectangle, foreColor, backColor, flags);
323
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red);
327
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue);
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);
339
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red);
343
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default);
347
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue);
351
TextRenderer
.DrawText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default);
355
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red);
359
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, Point.Empty, Color.Red, Color.Blue);
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);
371
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red);
375
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, TextFormatFlags.Default);
379
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue);
383
TextRenderer
.DrawText(mockDeviceContext.Object, "text".AsSpan(), SystemFonts.MenuFont, new Rectangle(1, 2, 300, 400), Color.Red, Color.Blue, TextFormatFlags.Default);
391
Assert.Throws<ArgumentNullException>("dc", () =>
TextRenderer
.DrawText(null, "text", SystemFonts.MenuFont, Point.Empty, Color.Red));
404
Size result =
TextRenderer
.MeasureText(text, font);
409
Assert.Equal(result,
TextRenderer
.MeasureText(text, font));
428
Size result =
TextRenderer
.MeasureText(text, font, proposedSize);
433
Assert.Equal(result,
TextRenderer
.MeasureText(text, font, proposedSize));
460
Size result =
TextRenderer
.MeasureText(text, font, proposedSize, flags);
465
Assert.Equal(result,
TextRenderer
.MeasureText(text, font, proposedSize, flags));
475
Size result =
TextRenderer
.MeasureText(graphics, text, font);
480
Assert.Equal(result,
TextRenderer
.MeasureText(graphics, text, font));
490
Size result =
TextRenderer
.MeasureText(graphics, text, font, proposedSize);
495
Assert.Equal(result,
TextRenderer
.MeasureText(graphics, text, font, proposedSize));
505
Size result =
TextRenderer
.MeasureText(graphics, text, font, proposedSize, flags);
510
Assert.Equal(result,
TextRenderer
.MeasureText(graphics, text, font, proposedSize, flags));
519
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text, SystemFonts.MenuFont));
520
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400)));
521
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default));
522
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text, SystemFonts.MenuFont));
523
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400)));
524
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default));
525
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text.AsSpan(), SystemFonts.MenuFont));
526
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400)));
527
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default));
528
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont));
529
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400)));
530
Assert.Equal(Size.Empty,
TextRenderer
.MeasureText(graphics, text.AsSpan(), SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default));
548
TextRenderer
.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont);
552
TextRenderer
.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400));
556
TextRenderer
.MeasureText(mockDeviceContext.Object, "text", SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default);
564
Assert.Throws<ArgumentNullException>("dc", () =>
TextRenderer
.MeasureText(null, string.Empty, SystemFonts.MenuFont));
565
Assert.Throws<ArgumentNullException>("dc", () =>
TextRenderer
.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400)));
566
Assert.Throws<ArgumentNullException>("dc", () =>
TextRenderer
.MeasureText(null, string.Empty, SystemFonts.MenuFont, new Size(300, 400), TextFormatFlags.Default));
591
TextRenderer
.DrawText(context, "Acrylic", SystemFonts.DefaultFont,
594
TextRenderer
.DrawText(context, "Acrylic", SystemFonts.DefaultFont,
597
TextRenderer
.DrawText(context, "Acrylic", SystemFonts.DefaultFont,
600
TextRenderer
.DrawText(context, "Acrylic", SystemFonts.DefaultFont,
615
() =>
TextRenderer
.DrawText(
622
() =>
TextRenderer
.DrawText(
630
() =>
TextRenderer
.DrawText(
637
() =>
TextRenderer
.DrawText(
645
() =>
TextRenderer
.MeasureText(
651
() =>
TextRenderer
.MeasureText(
673
TextRenderer
.DrawText(
696
TextRenderer
.DrawText(
727
Size size =
TextRenderer
.MeasureText(
766
TextRenderer
.DrawText(
814
Size size =
TextRenderer
.MeasureText(
TextBoxBaseTests.cs (3)
5085
int width =
TextRenderer
.MeasureText(control.Text, control.Font).Width;
5105
int width =
TextRenderer
.MeasureText(control.Text, control.Font).Width;
5128
int width =
TextRenderer
.MeasureText(control.Text, control.Font, Size.Empty, TextFormatFlags.SingleLine).Width;