Skip to content

Conversation

@JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Aug 25, 2020

Stock objects have a different define in metafile records. Correct values for API usage.

Add rectangle validation to the EMF validator and add regression tests for button and the Interop definitions.

Fixes #3770

Customer Impact

  • Flat style buttons and other controls that use a null/hollow brush don't render correctly.

Regression?

  • Yes

Risk

  • Low
Microsoft Reviewers: Open in CodeFlow

Stock objects have a different define in metafile records. Correct values for API usage.

Add rectangle validation to the EMF validator and add regression tests for button and the Interop definitions.
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner August 25, 2020 21:21
@ghost ghost assigned JeremyKuhne Aug 25, 2020
@JeremyKuhne JeremyKuhne added this to the 5.0 RC2 milestone Aug 25, 2020
using var emf = new EmfScope();
form.PrintToMetafile(emf);

var details = emf.RecordsToString();
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is how you get an idea of the records involved. Once you PrintToMetafile(emf) call emf.RecordsToString() to dump it out in the debugger.

@codecov
Copy link

codecov bot commented Aug 25, 2020

Codecov Report

Merging #3774 into master will decrease coverage by 31.19265%.
The diff coverage is n/a.

@@                 Coverage Diff                  @@
##              master       #3774          +/-   ##
====================================================
- Coverage   67.39429%   36.20164%   -31.19265%     
====================================================
  Files           1393         916         -477     
  Lines         504657      250403      -254254     
  Branches       40895       36662        -4233     
====================================================
- Hits          340110       90650      -249460     
+ Misses        158716      154636        -4080     
+ Partials        5831        5117         -714     
Flag Coverage Δ
#Debug 36.20164% <ø> (-31.19266%) ⬇️
#production 36.20164% <ø> (+0.01436%) ⬆️
#test ?

Flags with carried forward coverage won't be shown. Click here to find out more.

@JeremyKuhne JeremyKuhne merged commit 6f4b818 into dotnet:master Aug 25, 2020
@ghost ghost modified the milestones: 5.0 RC2, 6.0 Preview1 Aug 25, 2020

public bool IsStockObject => (index & 0x80000000) != 0;
public Gdi32.StockObject StockObject => (Gdi32.StockObject)index;
public Gdi32.StockObject StockObject => (Gdi32.StockObject)(index & ~0x80000000);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a comment about distinction between "regular" stock objects to EMF stock objects, but it looks like it did not get saved...

Because your explanation about the high order 1 in EMF stock objects is in a different file, this code will be more readable if you qualify what kind of stock object it is.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add some comments in master clarifying that EMF takes the twos complement to smuggle stock object identifiers.

JeremyKuhne added a commit to JeremyKuhne/winforms that referenced this pull request Aug 25, 2020
Stock objects have a different define in metafile records. Correct values for API usage.

Add rectangle validation to the EMF validator and add regression tests for button and the Interop definitions.
RussKie pushed a commit that referenced this pull request Aug 26, 2020
@ghost ghost locked as resolved and limited conversation to collaborators Jan 31, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

The BackColor & MouseOverBackColor property of Button doesn't work

2 participants