You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
During PR review it was noted that there is likely little test coverage of printing support of Controls. Printers typically use higher DPI and it was unclear how this represents itself during control rendering. The behavior should be checked and if possible tests should be added.
The most common usage of printing functionality I am aware of is used in reporting, where WinForms UserControls can be printed into a report. Sometimes people also want to print out a form filled with values for documentation purposes. Printing is also used to generate PDF or XPS documents to be sent by mail, so is not restricted to physical printers.
Describe the solution you'd like and alternatives you've considered
add tests for covering Control.DrawToBitmap, both for general functionality and also covering DPI behavior. Preliminary testing indicates that Control.DrawToBitmap currently ignores image DPI.
examine how WM_PRINT / WM_PRINTCLIENT scenarios are propagating DPI when rendering to a printer HDC (e.g. by calling PrintDlgEx to select a printer in a local test environment and use PrintWindow to trigger a WM_PRINT, or maybe send messages directly).
Depending on how WinForms reacts on native messages with a printer HDC it may not be necessary to have dedicated tests, if it also ignores DPI like DrawToBitmap does then test coverage through the latter might be enough. If drawing to a printer HDC actually preserves DPI then there should be tests added to provide coverage and prevent regressions. It might be possible to use the XPS printing driver which "prints" to a file of zipped xmls.
Will this feature affect UI controls?
no
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
During PR review it was noted that there is likely little test coverage of printing support of Controls. Printers typically use higher DPI and it was unclear how this represents itself during control rendering. The behavior should be checked and if possible tests should be added.
The most common usage of printing functionality I am aware of is used in reporting, where WinForms UserControls can be printed into a report. Sometimes people also want to print out a form filled with values for documentation purposes. Printing is also used to generate PDF or XPS documents to be sent by mail, so is not restricted to physical printers.
Describe the solution you'd like and alternatives you've considered
add tests for covering
Control.DrawToBitmap
, both for general functionality and also covering DPI behavior. Preliminary testing indicates thatControl.DrawToBitmap
currently ignores image DPI.examine how
WM_PRINT
/WM_PRINTCLIENT
scenarios are propagating DPI when rendering to a printer HDC (e.g. by callingPrintDlgEx
to select a printer in a local test environment and usePrintWindow
to trigger aWM_PRINT
, or maybe send messages directly).Depending on how WinForms reacts on native messages with a printer HDC it may not be necessary to have dedicated tests, if it also ignores DPI like
DrawToBitmap
does then test coverage through the latter might be enough. If drawing to a printer HDC actually preserves DPI then there should be tests added to provide coverage and prevent regressions. It might be possible to use the XPS printing driver which "prints" to a file of zipped xmls.Will this feature affect UI controls?
no
The text was updated successfully, but these errors were encountered: