Skip to content

Fix ControlPaint.Dark interpolation for SystemColors.Control - #14829

Merged
Shyam-Gupta merged 1 commit into
darc-main-df5ce6ac-c4fd-4820-8362-e0f3c36b45c4from
dev/shgu/colorFix
Jul 31, 2026
Merged

Fix ControlPaint.Dark interpolation for SystemColors.Control#14829
Shyam-Gupta merged 1 commit into
darc-main-df5ce6ac-c4fd-4820-8362-e0f3c36b45c4from
dev/shgu/colorFix

Conversation

@Shyam-Gupta

@Shyam-Gupta Shyam-Gupta commented Jul 30, 2026

Copy link
Copy Markdown
Member

This change fixes the test failures in codeflow PR #14825

Fix  ControlPaint.Dark(Color, float) for the SystemColors.Control  special-case path.

Problem

ControlPaint_Dark_InvokeColorFloat_ReturnsExpected  was failing for  SystemColors.Control  with negative darkening percentages because the interpolation logic performed an intermediate byte cast, producing incorrect channel values.

Solution

Perform the interpolation in  int  and cast to  byte  only once at the end of the calculation.

Testing

•  System.Windows.Forms.Tests.ControlPaint_Dark_InvokeColorFloat_ReturnsExpected 

Microsoft Reviewers: Open in CodeFlow

…special-case path.

Problem

ControlPaint_Dark_InvokeColorFloat_ReturnsExpected  was failing for  SystemColors.Control  with negative darkening percentages because the interpolation logic performed an intermediate byte cast, producing incorrect channel values.

Solution

Perform the interpolation in  int  and cast to  byte  only once at the end of the calculation.

Testing

•  System.Windows.Forms.Tests.ControlPaint_Dark_InvokeColorFloat_ReturnsExpected 
@Shyam-Gupta
Shyam-Gupta requested a review from a team as a code owner July 30, 2026 22:00
@Shyam-Gupta Shyam-Gupta self-assigned this Jul 30, 2026
@Shyam-Gupta

Copy link
Copy Markdown
Member Author

/azp run

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
1 pipeline(s) were filtered out due to trigger conditions.

@Shyam-Gupta
Shyam-Gupta merged commit e6ac4d6 into darc-main-df5ce6ac-c4fd-4820-8362-e0f3c36b45c4 Jul 31, 2026
2 checks passed
@Shyam-Gupta
Shyam-Gupta deleted the dev/shgu/colorFix branch July 31, 2026 15:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants