Skip to content

Commit fa70402

Browse files
committed
fix comments let user to decide which renderer to use. remove useless parameters
1 parent 5693427 commit fa70402

File tree

4 files changed

+6
-11
lines changed

4 files changed

+6
-11
lines changed

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/Button.cs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,8 +170,6 @@ private protected override bool OwnerDraw
170170
// ...the user wants to opt out of implicit DarkMode rendering.
171171
&& DarkModeRequestState is true
172172

173-
&& !ForeColorSet
174-
&& !BackColorSet
175173
// And all of this only counts for FlatStyle.Standard. For the
176174
// rest, we're using specific renderers anyway, which check
177175
// themselves on demand, if they need to apply Light- or DarkMode.

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/DarkMode/ButtonDarkModeAdapter.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ internal override void PaintUp(PaintEventArgs e, CheckState state)
9393
Control.Parent?.BackColor ?? Control.BackColor,
9494
GetButtonBackColor(pushButtonState),
9595
_ => PaintImage(e, layout),
96-
(_, textColor1, drawFocus) => PaintField(
96+
() => PaintField(
9797
e,
9898
layout,
9999
PaintDarkModeRender(e).Calculate(),
@@ -131,7 +131,7 @@ internal override void PaintDown(PaintEventArgs e, CheckState state)
131131
Control.Parent?.BackColor ?? Control.BackColor,
132132
GetButtonBackColor(PushButtonState.Pressed),
133133
_ => PaintImage(e, layout),
134-
(_, textColor, drawFocus) => PaintField(
134+
() => PaintField(
135135
e,
136136
layout,
137137
PaintDarkModeRender(e).Calculate(),
@@ -169,7 +169,7 @@ internal override void PaintOver(PaintEventArgs e, CheckState state)
169169
Control.Parent?.BackColor ?? Control.BackColor,
170170
GetButtonBackColor(PushButtonState.Hot),
171171
_ => PaintImage(e, layout),
172-
(_, textColor, drawFocus) => PaintField(
172+
() => PaintField(
173173
e,
174174
layout,
175175
PaintDarkModeRender(e).Calculate(),

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/DarkMode/ButtonDarkModeRendererBase.cs

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void RenderButton(
3939
Color parentBackgroundColor,
4040
Color backColor,
4141
Action<Rectangle> paintImage,
42-
Action<Rectangle, Color, bool> paintField)
42+
Action paintField)
4343
{
4444
ArgumentNullException.ThrowIfNull(graphics);
4545
ArgumentNullException.ThrowIfNull(paintImage);
@@ -66,10 +66,7 @@ public void RenderButton(
6666
// Paint image and field using the provided delegates
6767
paintImage(contentBounds);
6868

69-
paintField(
70-
contentBounds,
71-
GetTextColor(state, isDefault),
72-
false);
69+
paintField();
7370

7471
if (focused && showFocusCues)
7572
{

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/DarkMode/IButtonRenderer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ void RenderButton(
5050
Color parentBackgroundColor,
5151
Color backColor,
5252
Action<Rectangle> paintImage,
53-
Action<Rectangle, Color, bool> paintField);
53+
Action paintField);
5454

5555
/// <summary>
5656
/// Draws button background with appropriate styling.

0 commit comments

Comments
 (0)