Skip to content

Commit e17e417

Browse files
Leaf ShiLeaf Shi
authored andcommitted
Correct the parameter order for DrawBackgroundImage and using existing ImageBounds instead of the recalculated bounds
1 parent 3fa5fe4 commit e17e417

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

src/System.Windows.Forms/System/Windows/Forms/Controls/Buttons/ButtonInternal/ButtonBaseAdapter.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -549,15 +549,13 @@ internal void PaintImage(PaintEventArgs e, LayoutData layout)
549549
{
550550
if (Application.IsDarkModeEnabled && Control.DarkModeRequestState is true && Control.BackgroundImage is not null)
551551
{
552-
Rectangle bounds = Control.ClientRectangle;
553-
bounds.Inflate(-ButtonBorderSize, -ButtonBorderSize);
554552
ControlPaint.DrawBackgroundImage(
555553
e.GraphicsInternal,
556554
Control.BackgroundImage,
557555
Color.Transparent,
558556
Control.BackgroundImageLayout,
557+
layout.ImageBounds,
559558
Control.ClientRectangle,
560-
bounds,
561559
Control.DisplayRectangle.Location,
562560
Control.RightToLeft);
563561
}

0 commit comments

Comments
 (0)