1 write to Control
System.Windows.Forms (1)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (1)
19
internal ButtonBaseAdapter(ButtonBase control) =>
Control
= control.OrThrowIfNull();
186 references to Control
System.Windows.Forms (186)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (66)
34
if (
Control
.MouseIsDown)
38
else if (
Control
.MouseIsOver)
71
&& (
Control
.Focused ||
Control
.MouseIsOver || (
Control
.IsDefault &&
Control
.Enabled));
89
=> ControlPaint.CreateStringFormat(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
95
=> ControlPaint.CreateTextFormatFlags(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
105
if (
Control
.BackColor != SystemColors.Control && SystemInformation.HighContrast)
113
ControlPaint.DrawBorderSimple(deviceContext, bounds, ControlPaint.Dark(
Control
.BackColor));
132
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
235
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
368
if (
Control
.Focused &&
Control
.ShowFocusCues)
370
ControlPaint.DrawFocusRectangle(g, r,
Control
.ForeColor,
Control
.BackColor);
383
Control
.Width - (2 * ButtonBorderSize),
384
Control
.Height - (2 * ButtonBorderSize));
404
if (!
Control
.Enabled)
456
if (
Control
.UseCompatibleTextRendering)
464
if ((
Control
.TextAlign & LayoutUtils.AnyCenter) == 0)
470
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
474
g.DrawString(
Control
.Text,
Control
.Font, highlightBrush, r, stringFormat);
478
g.DrawString(
Control
.Text,
Control
.Font, shadowBrush, r, stringFormat);
484
g.DrawString(
Control
.Text,
Control
.Font, brush, r, stringFormat);
491
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
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);
518
Control
.PaintBackground(e, bounds);
548
if (
Control
.Image is not null)
551
DrawImageCore(e.GraphicsInternal,
Control
.Image, layout.ImageBounds, layout.ImageStart, layout);
592
Client = LayoutUtils.DeflateRect(
Control
.ClientRectangle,
Control
.Padding),
593
Padding =
Control
.Padding,
595
IsDefault =
Control
.IsDefault,
600
Font =
Control
.Font,
601
Text =
Control
.Text,
602
ImageSize = (
Control
.Image is null) ? Size.Empty :
Control
.Image.Size,
606
ImageAlign =
Control
.ImageAlign,
607
TextAlign =
Control
.TextAlign,
609
ShadowedText = !
Control
.Enabled,
610
LayoutRTL =
Control
.RightToLeft == RightToLeft.Yes,
611
TextImageRelation =
Control
.TextImageRelation,
612
UseCompatibleTextRendering =
Control
.UseCompatibleTextRendering
615
if (
Control
.FlatStyle != FlatStyle.System)
619
using StringFormat format =
Control
.CreateStringFormat();
624
layout.GdiTextFormatFlags =
Control
.CreateTextFormatFlags();
641
new(deviceContext,
Control
.ForeColor,
Control
.BackColor)
643
Enabled =
Control
.Enabled
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonFlatAdapter.cs (63)
17
rect.Inflate(-
Control
.FlatAppearance.BorderSize, -
Control
.FlatAppearance.BorderSize);
18
Control
.PaintBackground(e, rect, backColor, rect.Location);
23
bool hasCustomBorder =
Control
.FlatAppearance.BorderSize != BorderSize || !
Control
.FlatAppearance.BorderColor.IsEmpty;
27
up: !
Control
.FlatAppearance.CheckedBackColor.IsEmpty
30
Control
.FlatAppearance.BorderSize).Layout();
33
if (!
Control
.FlatAppearance.BorderColor.IsEmpty)
35
colors.WindowFrame =
Control
.FlatAppearance.BorderColor;
38
Rectangle r =
Control
.ClientRectangle;
40
Color backColor =
Control
.BackColor;
42
if (!
Control
.FlatAppearance.CheckedBackColor.IsEmpty)
47
backColor =
Control
.FlatAppearance.CheckedBackColor;
50
backColor =
Control
.FlatAppearance.CheckedBackColor.MixColor(colors.ButtonFace);
69
if (
Control
.IsDefault)
77
if (
Control
.Focused &&
Control
.ShowFocusCues)
82
if (!(
Control
.IsDefault &&
Control
.Focused && (
Control
.FlatAppearance.BorderSize == 0)))
84
DrawDefaultBorder(e, r, colors.WindowFrame,
Control
.IsDefault);
90
if (
Control
.FlatAppearance.BorderSize != BorderSize)
92
DrawFlatBorderWithSize(e, r, colors.WindowFrame,
Control
.FlatAppearance.BorderSize);
116
bool hasCustomBorder = (
Control
.FlatAppearance.BorderSize != BorderSize || !
Control
.FlatAppearance.BorderColor.IsEmpty);
120
!
Control
.FlatAppearance.CheckedBackColor.IsEmpty
123
Control
.FlatAppearance.BorderSize).Layout();
126
if (!
Control
.FlatAppearance.BorderColor.IsEmpty)
128
colors.WindowFrame =
Control
.FlatAppearance.BorderColor;
131
Rectangle r =
Control
.ClientRectangle;
133
Color backColor =
Control
.BackColor;
135
if (!
Control
.FlatAppearance.MouseDownBackColor.IsEmpty)
137
backColor =
Control
.FlatAppearance.MouseDownBackColor;
157
if (
Control
.IsDefault)
165
if (
Control
.Focused &&
Control
.ShowFocusCues)
170
if (!(
Control
.IsDefault &&
Control
.Focused && (
Control
.FlatAppearance.BorderSize == 0)))
172
DrawDefaultBorder(e, r, colors.WindowFrame,
Control
.IsDefault);
178
if (
Control
.FlatAppearance.BorderSize != BorderSize)
180
DrawFlatBorderWithSize(e, r, colors.WindowFrame,
Control
.FlatAppearance.BorderSize);
210
bool hasCustomBorder =
Control
.FlatAppearance.BorderSize != BorderSize || !
Control
.FlatAppearance.BorderColor.IsEmpty;
214
up: !
Control
.FlatAppearance.CheckedBackColor.IsEmpty || state == CheckState.Unchecked,
216
Control
.FlatAppearance.BorderSize).Layout();
219
if (!
Control
.FlatAppearance.BorderColor.IsEmpty)
221
colors.WindowFrame =
Control
.FlatAppearance.BorderColor;
224
Rectangle r =
Control
.ClientRectangle;
227
if (!
Control
.FlatAppearance.MouseOverBackColor.IsEmpty)
229
backColor =
Control
.FlatAppearance.MouseOverBackColor;
231
else if (!
Control
.FlatAppearance.CheckedBackColor.IsEmpty)
234
?
Control
.FlatAppearance.CheckedBackColor.MixColor(colors.LowButtonFace)
246
if (
Control
.IsDefault)
259
if (
Control
.Focused &&
Control
.ShowFocusCues)
264
if (!(
Control
.IsDefault &&
Control
.Focused && (
Control
.FlatAppearance.BorderSize == 0)))
266
DrawDefaultBorder(e, r, colors.WindowFrame,
Control
.IsDefault);
272
if (
Control
.FlatAppearance.BorderSize != BorderSize)
274
DrawFlatBorderWithSize(e, r, colors.WindowFrame,
Control
.FlatAppearance.BorderSize);
293
PaintFlatLayout(up: false, check: true,
Control
.FlatAppearance.BorderSize);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonPopupAdapter.cs (13)
18
Rectangle r =
Control
.ClientRectangle;
27
Control
.PaintBackground(e, r, IsHighContrastHighlighted() ? SystemColors.Highlight :
Control
.BackColor, r.Location);
30
if (
Control
.IsDefault)
47
DrawDefaultBorder(e, r, borderColor,
Control
.IsDefault);
64
Rectangle r =
Control
.ClientRectangle;
73
Control
.PaintBackground(e, r, IsHighContrastHighlighted() ? SystemColors.Highlight :
Control
.BackColor, r.Location);
76
if (
Control
.IsDefault)
84
DrawDefaultBorder(e, r, colors.Options.HighContrast ? colors.WindowText : colors.ButtonShadow,
Control
.IsDefault);
122
Rectangle r =
Control
.ClientRectangle;
124
if (
Control
.IsDefault)
135
DrawDefaultBorder(e, r, colors.Options.HighContrast ? colors.WindowText : colors.WindowFrame,
Control
.IsDefault);
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonStandardAdapter.cs (25)
24
else if (
Control
.MouseIsOver)
28
else if (!
Control
.Enabled)
32
else if (
Control
.Focused ||
Control
.IsDefault)
53
ButtonRenderer.DrawParentBackground(e, bounds,
Control
);
58
Control
.ClientRectangle,
61
ScaleHelper.IsScalingRequirementMet ?
Control
.HWNDInternal : HWND.Null);
70
if (!
Control
.UseVisualStyleBackColor)
73
Color color = isHighContrastHighlighted ? SystemColors.Highlight :
Control
.BackColor;
87
:
Control
.BackColorBrush);
92
if (
Control
.BackgroundImage is not null && !DisplayInformation.HighContrast)
96
Control
.BackgroundImage,
98
Control
.BackgroundImageLayout,
99
Control
.ClientRectangle,
101
Control
.DisplayRectangle.Location,
102
Control
.RightToLeft);
122
_ =
Control
as Button;
125
PaintThemedButtonBackground(e,
Control
.ClientRectangle, up);
137
Rectangle bounds =
Control
.ClientRectangle;
160
if (Application.RenderWithVisualStyles &&
Control
.FlatStyle != FlatStyle.Standard)
170
if (
Control
.Focused &&
Control
.ShowFocusCues)
187
Rectangle r =
Control
.ClientRectangle;
188
if (
Control
.IsDefault)
193
DrawDefaultBorder(e, r, colors.WindowFrame,
Control
.IsDefault);
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckableControlBaseAdapter.cs (4)
45
if (
Control
is CheckBox checkBox)
50
if (
Control
is RadioButton radioButton)
55
Debug.Fail($"Unexpected control type '{
Control
.GetType().FullName}'");
72
internal double GetDpiScaleRatio() => GetDpiScaleRatio(
Control
);
System\Windows\Forms\Controls\Buttons\ButtonInternal\CheckBoxBaseAdapter.cs (1)
26
protected new CheckBox Control => (CheckBox)base.
Control
;
System\Windows\Forms\Controls\Buttons\ButtonInternal\RadioButtonBaseAdapter.cs (1)
12
protected new RadioButton Control => (RadioButton)base.
Control
;
System\Windows\Forms\Controls\PropertyGrid\PropertyGridInternal\DropDownButton.DropDownButtonAdapter.cs (13)
18
if (
Control
.BackColor != SystemColors.Control && SystemInformation.HighContrast)
22
Color c = ControlPaint.LightLight(
Control
.BackColor);
32
ControlPaint.DrawBorderSimple(e, r, ControlPaint.Dark(
Control
.BackColor));
39
Color c = ControlPaint.Light(
Control
.BackColor);
44
Control
.BackColor, 2, ButtonBorderStyle.Outset,
45
Control
.BackColor, 2, ButtonBorderStyle.Outset);
51
c = ControlPaint.LightLight(
Control
.BackColor);
61
ControlPaint.DrawBorderSimple(e, r, ControlPaint.Dark(
Control
.BackColor));
71
DDB_Draw3DBorder(pevent,
Control
.ClientRectangle, raised: true);
76
Rectangle rect =
Control
.ClientRectangle;
89
bool isHighContrastHighlighted = !
Control
.MouseIsDown && IsHighContrastHighlighted();
90
Color backgroundColor = isHighContrastHighlighted ? SystemColors.Highlight :
Control
.BackColor;
93
using Image invertedImage = ControlPaint.CreateBitmapWithInvertedForeColor(bitmap,
Control
.BackColor);