Skip to content

PrintPreviewControl displays a black preview page after assigning an empty PrintDocument #14838

Description

@Olina-Zhang

.NET version

.NET 11 SDK build: 11.0.100-rc.1.26380.103

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

Yes, regression from the PR: #14424

Issue description

After PR #14424, PrintPreviewControl.ResetForeColor() was changed to use SystemColors.ControlText as the default ForeColor. It resolves the inconsistency tracked by GH issue: #14420

But with the new default behavior in .NET 11, assigning a PrintDocument that produces no printable content causes the preview page to render as a solid black page.

Image

As a result, existing applications that preview dark-colored content may experience poor readability due to the black preview background.

Image

Steps to reproduce

  1. Create a WinForms application with targeting .NET 11.
  2. Add a PrintPreviewControl to the form.
  3. Leave its ForeColor unchanged (default value: SystemColors.ControlText).
  4. Add PrintDocument and assign it to PrintPreviewControl's Document property
  5. Run the application.

Actual Result

The preview page is rendered as a solid black page.

Expected Result

Assigning an empty PrintDocument should not cause the preview page to become black.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions