Support for the Win11 22H2 UnifiedPrintDialog #13264
Labels
api-suggestion
(1) Early API idea and discussion, it is NOT ready for implementation
Regression by Win-OS
Milestone
.NET version
.NET8
Did it work in .NET Framework?
Not tested/verified
Did it work in any of the earlier releases of .NET Core or .NET 5+?
No response
Issue description
Windows 11 22H2 introduced a new UnifiedPrintDialog that is shown when the System.Windows.Forms.PrintDialog is used.
I see two problems in this situation:
Problem 1:
I can set Landscape/portrait orientation by setting
printDialog.PrinterSettings.DefaultPageSettings.Landscape = true
. But this is ignored by the new dialog. After clicking "OK", the predefined orientation thus is lost, only the setting in the dialog is applied.Problem 2:
There is no way to populate the page preview box to the right. This is actually an unnecessary feature for me, as it happens for me when using a commercial reporting tool which provides a page preview control. In this control, the "print" button just shows the printer selection dialog, and page setup (e.g. orientation) is done in other controls).
The easiest way to resolve this is probably to set the registry key "Computer\HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog\PreferLegacyPrintDialog" = 1 (see e.g. https://www.vbforums.com/showthread.php?901260-The-modern-print-dialog-issue-after-Windows-11-22H2-update).
This brings back the old dialog.
Would it be possible to add a property to "PrintDialog" similar to "UseEXDialog" which enables/disables the Win11 form? This would resolve the issue for me, as I cannot populate the page preview in my app.
I assume this issue is already known, but I did not find anything in this repository.
Similar issue for WPF: https://www.github.com/dotnet/wpf/issues/8355
Steps to reproduce
Attached is a small sample:
WinFormsPrintDialog.zip
You can set landscape/portrait with two radio buttons, then click the "Print Dialog" button => now the new dialog should be shown which is always set to "landscape".
If you set the registry key "Computer\HKEY_CURRENT_USER\Software\Microsoft\Print\UnifiedPrintDialog\PreferLegacyPrintDialog" = 1 and perform the same steps, you should see that the landscape setting is applied to the printer settings. So, it worked in the old version of the form.
The text was updated successfully, but these errors were encountered: