Skip to content
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

Convert the rest of System.Drawing printing to CsWin32 #10598

Merged
merged 1 commit into from
Jan 8, 2024

Conversation

JeremyKuhne
Copy link
Member

@JeremyKuhne JeremyKuhne commented Jan 6, 2024

This moves the rest of System.Drawing.Printing to CsWin32.

  • Move now-shared API to Core assembly
  • Update calls to PInvokeCore for said calls
  • Add HdcHandle for HDCs that we have to keep in fields
  • Move printing DeviceContext usages to scopes
  • Use new printer dialog to get default printer names
  • Remove ScreenDC and use scope
Microsoft Reviewers: Open in CodeFlow

This moves the rest of System.Drawing.Printing to CsWin32.

- Move now-shared API to Core assembly
- Update calls to PInvokeCore for said calls
- Add HdcHandle for HDCs that we have to keep in fields
- Move printing DeviceContext usages to scopes
- Use new printer dialog to get default printer names
- Remove ScreenDC and use scope
@JeremyKuhne JeremyKuhne requested a review from a team as a code owner January 6, 2024 00:09
@ghost ghost assigned JeremyKuhne Jan 6, 2024
@elachlan
Copy link
Contributor

elachlan commented Jan 6, 2024

Does this resolve #10293 and #9879?

@JeremyKuhne
Copy link
Member Author

Does this resolve #10293 and #9879?

It only makes progress towards those

Copy link
Contributor

@DJm00n DJm00n Jan 6, 2024

Choose a reason for hiding this comment

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

Maybe you can also remove LogicalDpi from DpiHelper.cs and OneHundredPercentLogicalDpi from ScaleHelper.cs and make use of PInvoke.USER_DEFAULT_SCREEN_DPI instead?

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. I'll look at adding it.

// Here, we'll check to see if we are in a terminal services session...
(((User32.GetSystemMetrics(NativeMethods.SM_REMOTESESSION) & 0x00000001) != 0) && (error == 0)))
// Here, we'll check to see if we are in a terminal services session.
(((PInvokeCore.GetSystemMetrics(SYSTEM_METRICS_INDEX.SM_REMOTESESSION) & 0x00000001) != 0) && (error == 0)))
Copy link
Member

Choose a reason for hiding this comment

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

Is the 0x00000001 = SYSTEM_METRICS_INDEX.SM_REMOTESESSION? Maybe we can use that to be clear here.

@JeremyKuhne
Copy link
Member Author

@lonitra I can address your feedback in a subsequent PR as I have a few in progress. :)

Copy link
Member

@lonitra lonitra left a comment

Choose a reason for hiding this comment

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

:shipit:

@JeremyKuhne JeremyKuhne merged commit 4677001 into dotnet:main Jan 8, 2024
9 checks passed
@JeremyKuhne JeremyKuhne deleted the printerinterop branch January 8, 2024 20:01
@ghost ghost added this to the 9.0 Preview1 milestone Jan 8, 2024
@github-actions github-actions bot locked and limited conversation to collaborators Feb 8, 2024
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.

4 participants