Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

printdialog.showdialog(); not showing the print dialog in windows 7 with 64 bit

I have custom control with print toolbar item.when print the control the dialog is not coming in windows 7 with 64 bit os in other system os working fine. problem only in windows 7 with 64 bit.

my problem printdialog is not coming in windows 7 os with 64 bit.

i have checked and anlyaed -->PrintDialog.ShowDialog() returns immeaditely cancel instaed of showing the dialog thats the problem.

i have found the solution for the problem by searched following links:

http://social.msdn.microsoft.com/Forums/en/netfx64bit/thread/8760fb6c-ae63-444e-9606-cd3295ce6b5d

http://msdn.microsoft.com/en-us/library/system.windows.forms.printdialog.useexdialog.aspx

by setting true to UseExDialog property of printdialog the dialog comes and working fine.but this dialog style is like windows XP not windows7 style.so this is not excat solution.

UseExDialog property sets to true means working fine.but the print dialog style looks like windows XP print not like windows 7. i need some other solution for showing print dialog in windows 7 os with 64 bit.

please provide complete solution for this problem

Thanks

Siva

like image 368
sivarajini Avatar asked Jun 17 '11 12:06

sivarajini


People also ask

Why does no invoke printdialog() not show the print dialog?

No Invoke PrintDialog.ShowDialog () does not show Print dialog successfully. This is a regression issue, it's not reproducing when targeting .NET Core 3.1. This issue also cannot reproduce with Framework project. No expected Print dialog shown. The Print dialog should be shown successfully.

How to use the ShowDialog method in code?

The following example shows how to use the ShowDialog method in code. private void InvokePrint (object sender, RoutedEventArgs e) { // Create the print dialog object and set options PrintDialog pDialog = new PrintDialog (); pDialog.PageRangeSelection = PageRangeSelection.AllPages; pDialog.UserPageRangeEnabled = true; // Display the dialog.

Why is the print dialog not reproducing with WinForms core?

This is a regression issue, it's not reproducing when targeting .NET Core 3.1. This issue also cannot reproduce with Framework project. No expected Print dialog shown. The Print dialog should be shown successfully. Create a Winforms Core application. Drag and drop a button to the form. Build and run.

How do I get the print dialog to pop up?

The Print dialog should be shown successfully. Create a Winforms Core application. Drag and drop a button to the form. Build and run. Click the button1 to see whether the Print dialog is popping up. I haven't bisected, but looking at the history we probably disturbed it in #2594.


2 Answers

Per Microsoft's Forums:

via Mike Dos Zhang (MSFT CSG)

The PrintDialog class may not work on AMD64(x64 or Any CPU is belong to AMD64 technical, including intel x64cpu) microprocessors unless you set the UseEXDialog property to true.

This is a known issue.

And this limitation has been supported in .net framework4, so if you want use this class with windows7 style dialog, then you will need to use .net framework4, otherwise you will need to use the xp style dialog with set the UseEXDialog property to true, or using x86 target platform.

In my case the 2nd known issue was it... we upgraded from .NET 2.0 to .NET 4.0 and it started working again without any code changes (to the printing).

like image 153
uzbones Avatar answered Sep 26 '22 19:09

uzbones


If you can't or don't like to set UseEXDialog = true an alternative would be setting your Plattform to x86

The disadvantage is obvious, but doing so should give you the advantage of not needing to upgrade your .NET Framework like uzbones did, which also could create problems.

like image 20
WiiMaxx Avatar answered Sep 24 '22 19:09

WiiMaxx