Development and Programming
C# and .NET
PrintDialog causes in a visual style exception
The following C# statement causes causes in a visual style exception thrown.
PrintDialog pd = new PrintDialog();
"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:
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;
© 2019 Digcode.com. All rights reserved.