Skip to content
1 change: 1 addition & 0 deletions src/System.Windows.Forms/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
override System.Windows.Forms.Button.BackgroundImage.set -> void
override System.Windows.Forms.ButtonBase.OnBackColorChanged(System.EventArgs! e) -> void
override System.Windows.Forms.ButtonBase.OnForeColorChanged(System.EventArgs! e) -> void
static System.Windows.Forms.Application.SetColorMode(System.Windows.Forms.SystemColorMode systemColorMode) -> void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,18 @@ public virtual DialogResult DialogResult
}
}

public override Image? BackgroundImage
{
set
{
base.BackgroundImage = value;

// BackgroundImage changes may affect rendering logic,
// so we manually update the OwnerDraw flag to ensure correct visual behavior.
UpdateOwnerDraw();
}
}

/// <summary>
/// Defines, whether the control is owner-drawn. Based on this,
/// the UserPaint flags get set, which in turn makes it later
Expand All @@ -161,7 +173,6 @@ private protected override bool OwnerDraw
get
{
if (Application.IsDarkModeEnabled

// The SystemRenderer cannot render images. So, we flip to our
// own DarkMode renderer, if we need to render images, except if...
&& Image is null
Expand Down