Skip to content

The DialogResult of PrintDialog is not correct when setting its UseEXDialog is false and clicking Cancel for dialog #10920

@Olina-Zhang

Description

@Olina-Zhang

.NET version

.NET 9.0 SDK build: 9.0.100-preview.2.24116.21

Did it work in .NET Framework?

Yes

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

Yes, cannot repro previous version: .NET 8.0 SDK build

Issue description

When setting PrintDialog's UseEXDialog is false and clicking Cancel button for this dialog, the value of DialogResult is OK, not Cancel.

.NET 9.0 Result:

DialogResult_Cancel_Net9.0.mp4

.Net 8.0 Result:

DialogResult_Cancel_Net8.0.mp4

Steps to reproduce

  1. Create a Winforms application with a button, textBox and a PrintDialog
  2. Double-click button and add following code:
private void button1_Click(object sender, EventArgs e)
{
    DialogResult result;

    printDialog1.UseEXDialog = false;
    result = printDialog1.ShowDialog();
    
    textBox1.Text = result.ToString();  
}

or use this sample application:
PrintDialogSample.zip

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions