-
Notifications
You must be signed in to change notification settings - Fork 1k
Update the OwnerDraw flag when BackgroundImage changes #13824
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
d495460
0fee68a
6377f2e
3fa5fe4
9e82a5f
7740992
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -547,21 +547,6 @@ internal void PaintField( | |
/// </summary> | ||
internal void PaintImage(PaintEventArgs e, LayoutData layout) | ||
{ | ||
if (Application.IsDarkModeEnabled && Control.DarkModeRequestState is true && Control.BackgroundImage is not null) | ||
{ | ||
Rectangle bounds = Control.ClientRectangle; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What I do not understand is: We paint:
If we are not deflating the Bounds, aren't we then painting over the Image? What if the Image got important markers in its outer border? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. According to the previous logic, our drawing order was incorrect.
This has now been corrected. Under the original logic
So, under dark mode, the background color size > the border size > the background image size. |
||
bounds.Inflate(-ButtonBorderSize, -ButtonBorderSize); | ||
ControlPaint.DrawBackgroundImage( | ||
e.GraphicsInternal, | ||
Control.BackgroundImage, | ||
Color.Transparent, | ||
Control.BackgroundImageLayout, | ||
Control.ClientRectangle, | ||
bounds, | ||
Control.DisplayRectangle.Location, | ||
Control.RightToLeft); | ||
} | ||
|
||
if (Control.Image is not null) | ||
{ | ||
// Setup new clip region & draw | ||
|
Uh oh!
There was an error while loading. Please reload this page.