1 write to Control
System.Windows.Forms (1)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (1)
20
internal ButtonBaseAdapter(ButtonBase control) =>
Control
= control.OrThrowIfNull();
228 references to Control
System.Windows.Forms (228)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (74)
36
if (
Control
.MouseIsDown)
40
else if (
Control
.MouseIsOver)
105
options.Client = LayoutUtils.DeflateRect(contentBounds,
Control
.Padding);
123
&& (
Control
.Focused ||
Control
.MouseIsOver || (
Control
.IsDefault &&
Control
.Enabled));
141
=> ControlPaint.CreateStringFormat(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
147
=> ControlPaint.CreateTextFormatFlags(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
157
if (
Control
.BackColor != SystemColors.Control && SystemInformation.HighContrast)
165
ControlPaint.DrawBorderSimple(deviceContext, bounds, ControlPaint.Dark(
Control
.BackColor));
184
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
287
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
420
if (
Control
.Focused &&
Control
.ShowFocusCues)
422
ControlPaint.DrawFocusRectangle(g, r,
Control
.ForeColor,
Control
.BackColor);
437
Control
.Width - (2 * ButtonBorderSize),
438
Control
.Height - (2 * ButtonBorderSize));
462
if (!
Control
.Enabled)
518
if (
Control
.UseCompatibleTextRendering)
526
if ((
Control
.TextAlign & LayoutUtils.AnyCenter) == 0)
532
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
536
g.DrawString(
Control
.Text,
Control
.Font, highlightBrush, r, stringFormat);
540
g.DrawString(
Control
.Text,
Control
.Font, shadowBrush, r, stringFormat);
546
g.DrawString(
Control
.Text,
Control
.Font, brush, r, stringFormat);
553
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
558
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.ButtonShadow, formatFlags);
563
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.Highlight, formatFlags);
566
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.ButtonShadow, formatFlags);
571
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, color, formatFlags);
580
Control
.PaintBackground(e, bounds);
612
if (
Control
.BackgroundImage is null
618
Rectangle imageClip = clipRectangle ??
Control
.ClientRectangle;
626
Control
.BackgroundImage,
628
Control
.BackgroundImageLayout,
629
Control
.ClientRectangle,
631
Control
.DisplayRectangle.Location,
632
Control
.RightToLeft);
640
if (
Control
.Image is not null)
643
DrawImageCore(e.GraphicsInternal,
Control
.Image, layout.ImageBounds, layout.ImageStart, layout);
684
Client = LayoutUtils.DeflateRect(
Control
.ClientRectangle,
Control
.Padding),
685
Padding =
Control
.Padding,
687
IsDefault =
Control
.IsDefault,
692
Font =
Control
.Font,
693
Text =
Control
.Text,
694
ImageSize = (
Control
.Image is null) ? Size.Empty :
Control
.Image.Size,
698
ImageAlign =
Control
.ImageAlign,
699
TextAlign =
Control
.TextAlign,
701
ShadowedText = !
Control
.Enabled,
702
LayoutRTL =
Control
.RightToLeft == RightToLeft.Yes,
703
TextImageRelation =
Control
.TextImageRelation,
704
UseCompatibleTextRendering =
Control
.UseCompatibleTextRendering
707
if (
Control
.FlatStyle != FlatStyle.System)
711
using StringFormat format =
Control
.CreateStringFormat();
716
layout.GdiTextFormatFlags =
Control
.CreateTextFormatFlags();
733
new(deviceContext,
Control
.ForeColor,
Control
.BackColor)
735
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;
226
Color backColor = !
Control
.FlatAppearance.MouseOverBackColor.IsEmpty
227
?
Control
.FlatAppearance.MouseOverBackColor
228
: !
Control
.FlatAppearance.CheckedBackColor.IsEmpty
230
?
Control
.FlatAppearance.CheckedBackColor.MixColor(colors.LowButtonFace)
238
if (
Control
.IsDefault)
254
if (
Control
.Focused &&
Control
.ShowFocusCues)
259
if (!(
Control
.IsDefault &&
Control
.Focused && (
Control
.FlatAppearance.BorderSize == 0)))
261
DrawDefaultBorder(e, r, colors.WindowFrame,
Control
.IsDefault);
267
if (
Control
.FlatAppearance.BorderSize != BorderSize)
269
DrawFlatBorderWithSize(e, r, colors.WindowFrame,
Control
.FlatAppearance.BorderSize);
288
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\DarkMode\ButtonDarkModeAdapter.cs (34)
38
_buttonDarkModeRenderer.DeviceDpi =
Control
.DeviceDpi;
50
if (_modern && !
Control
.Enabled)
53
Control
.ForeColor,
58
?
Control
.ShouldSerializeForeColor()
59
:
Control
.ForeColor != Forms.Control.DefaultForeColor;
63
textColor =
Control
.Enabled
64
&&
Control
.EffectiveVisualStylesModeInternal >= VisualStylesMode.Net11
65
?
Control
.ForeColor
66
: new ColorOptions(deviceContext,
Control
.ForeColor,
Control
.BackColor)
68
Enabled =
Control
.Enabled
78
textColor = ButtonDarkModeRenderer.GetTextColor(state,
Control
.IsDefault, backColor);
88
if (
Control
.BackColor != Forms.Control.DefaultBackColor)
92
Control
.IsDefault,
93
Control
.BackColor);
104
Control
.IsDefault,
110
Control
.BackColorAnimator.AnimateTo(backColor);
111
backColor =
Control
.BackColorAnimator.CurrentColor;
118
=> PaintCore(e, ToPushButtonState(state,
Control
.Enabled));
135
Color parentBackColor =
Control
.Parent?.BackColor ??
Control
.BackColor;
139
Control
,
140
Control
.ClientRectangle,
141
Control
.FlatStyle,
143
Control
.IsDefault,
144
Control
.Focused,
145
Control
.ShowFocusCues,
170
=>
Control
.FlatStyle == FlatStyle.Popup && _modern
174
Control
.DeviceDpi,
175
Control
.FlatAppearance.BorderSize)
186
layout.DisableWordWrapping =
Control
.AutoSize;
197
new(deviceContext,
Control
.ForeColor,
Control
.BackColor)
199
Enabled =
Control
.Enabled
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));
72
DDB_Draw3DBorder(pevent,
Control
.ClientRectangle, raised: true);
77
Rectangle rect =
Control
.ClientRectangle;
90
bool isHighContrastHighlighted = !
Control
.MouseIsDown && IsHighContrastHighlighted();
91
Color backgroundColor = isHighContrastHighlighted ? SystemColors.Highlight :
Control
.BackColor;
94
using Image invertedImage = ControlPaint.CreateBitmapWithInvertedForeColor(bitmap,
Control
.BackColor);