web analytics
PrintDialog causes in a visual style exception Options
codeling
Posted: Thursday, June 7, 2018 12:08:47 PM

Rank:Advanced Member
Groups: Member
Joined: 12/11/2015
Posts: 978
Points: 4113

The following C# statement causes causes in a visual style exception thrown.

PrintDialog pd = new PrintDialog();

pd.ShowDialog();

"Visual styles related operation resulted in an error because visuals types are currently disabled in the client area"

It is responsible for disable the visual style renderer. I don't know why he is doing that.

I have tried to reenable the visual style immediately after closing the print dialog with:

Application.EnableVisualStyles();

but without success.

The fact is that the printer driver changes the "VisualStyleState" value. To solve this, you can rechanged the property to the default setting directly after closing the "PrintDialog" with:

Application.VisualStyleState = VisualStyleState.ClientAndNonClientAreasEnabled;

 

Sponsor
Posted: Thursday, June 7, 2018 12:08:47 PM
 
Users browsing this topic
Guest

Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.


© 2018 Digcode.com. All rights reserved.