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();
211 references to Control
System.Windows.Forms (211)
System\Windows\Forms\Controls\Buttons\ButtonInternal\ButtonBaseAdapter.cs (66)
35
if (
Control
.MouseIsDown)
39
else if (
Control
.MouseIsOver)
73
&& (
Control
.Focused ||
Control
.MouseIsOver || (
Control
.IsDefault &&
Control
.Enabled));
91
=> ControlPaint.CreateStringFormat(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
97
=> ControlPaint.CreateTextFormatFlags(
Control
,
Control
.TextAlign,
Control
.ShowToolTip,
Control
.UseMnemonic);
107
if (
Control
.BackColor != SystemColors.Control && SystemInformation.HighContrast)
115
ControlPaint.DrawBorderSimple(deviceContext, bounds, ControlPaint.Dark(
Control
.BackColor));
134
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
237
bool disabledHighContrast = (!
Control
.Enabled) && SystemInformation.HighContrast;
370
if (
Control
.Focused &&
Control
.ShowFocusCues)
372
ControlPaint.DrawFocusRectangle(g, r,
Control
.ForeColor,
Control
.BackColor);
385
Control
.Width - (2 * ButtonBorderSize),
386
Control
.Height - (2 * ButtonBorderSize));
406
if (!
Control
.Enabled)
458
if (
Control
.UseCompatibleTextRendering)
466
if ((
Control
.TextAlign & LayoutUtils.AnyCenter) == 0)
472
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
476
g.DrawString(
Control
.Text,
Control
.Font, highlightBrush, r, stringFormat);
480
g.DrawString(
Control
.Text,
Control
.Font, shadowBrush, r, stringFormat);
486
g.DrawString(
Control
.Text,
Control
.Font, brush, r, stringFormat);
493
if (disabledText3D && !
Control
.Enabled && !colors.Options.HighContrast)
498
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.ButtonShadow, formatFlags);
503
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.Highlight, formatFlags);
506
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, colors.ButtonShadow, formatFlags);
511
TextRenderer.DrawTextInternal(e,
Control
.Text,
Control
.Font, r, color, formatFlags);
520
Control
.PaintBackground(e, bounds);
550
if (
Control
.Image is not null)
553
DrawImageCore(e.GraphicsInternal,
Control
.Image, layout.ImageBounds, layout.ImageStart, layout);
594
Client = LayoutUtils.DeflateRect(
Control
.ClientRectangle,
Control
.Padding),
595
Padding =
Control
.Padding,
597
IsDefault =
Control
.IsDefault,
602
Font =
Control
.Font,
603
Text =
Control
.Text,
604
ImageSize = (
Control
.Image is null) ? Size.Empty :
Control
.Image.Size,
608
ImageAlign =
Control
.ImageAlign,
609
TextAlign =
Control
.TextAlign,
611
ShadowedText = !
Control
.Enabled,
612
LayoutRTL =
Control
.RightToLeft == RightToLeft.Yes,
613
TextImageRelation =
Control
.TextImageRelation,
614
UseCompatibleTextRendering =
Control
.UseCompatibleTextRendering
617
if (
Control
.FlatStyle != FlatStyle.System)
621
using StringFormat format =
Control
.CreateStringFormat();
626
layout.GdiTextFormatFlags =
Control
.CreateTextFormatFlags();
643
new(deviceContext,
Control
.ForeColor,
Control
.BackColor)
645
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 (25)
41
Control
.ClientRectangle,
42
Control
.FlatStyle,
43
ToPushButtonState(state,
Control
.Enabled),
44
Control
.IsDefault,
45
Control
.Focused,
46
Control
.ShowFocusCues,
47
Control
.Parent?.BackColor ??
Control
.BackColor,
78
Control
.ClientRectangle,
79
Control
.FlatStyle,
81
Control
.IsDefault,
82
Control
.Focused,
83
Control
.ShowFocusCues,
84
Control
.Parent?.BackColor ??
Control
.BackColor,
115
Control
.ClientRectangle,
116
Control
.FlatStyle,
118
Control
.IsDefault,
119
Control
.Focused,
120
Control
.ShowFocusCues,
121
Control
.Parent?.BackColor ??
Control
.BackColor,
151
new(deviceContext,
Control
.ForeColor,
Control
.BackColor)
153
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;
91
bool isHighContrastHighlighted = !
Control
.MouseIsDown && IsHighContrastHighlighted();
92
Color backgroundColor = isHighContrastHighlighted ? SystemColors.Highlight :
Control
.BackColor;
95
using Image invertedImage = ControlPaint.CreateBitmapWithInvertedForeColor(bitmap,
Control
.BackColor);