For WinForms applications calling FileDialog on Win10, the context menu is empty when using NoneEnabled for Application.VisualStyleState

1

I have this issue with a WinForms project using forms with complex controls.
With a certain degree of complexity (e.g. controls number), WinForms can become very slow, this I know.
So to get reasonable display performance, Application.VisualStyleState is disabled:
Application.VisualStyleState = System.Windows.Forms.VisualStyles.VisualStyleState.NoneEnabled;

Using the faster "Windows classic theme" makes the WinForms controls performance bearable (unfortunately the generally desirable WPF port is not in scope).

Now on Win10 systems (no issue on Win7), WinForms FileDialog controls called by the app do show an "empty" context menu for right-clicked items:
enter image description here

I am okay with the 'old' Win7 style in general by the way. My concern is just the empty context menu.

Attempts for alternatives using a WPF FileDialog or a WindowsAPICodePack FileDialog throw both this exception:
"Creating an instance of the COM component with CLSID {DC1C5A9C-E88A-4DDE-A5A1-60F82A20AEF7} from the IClassFactory failed due to the following error: 80040111 ClassFactory cannot supply requested class (Exception from HRESULT: 0x80040111 (CLASS_E_CLASSNOTAVAILABLE))."

Any suggestions how to get the context menu entries back for my scenario using the WinForms FileDialog on Win10?
Or how to make one of the alternatives work (I know they all call the same native WIN32 functions)?

c#
wpf
winforms
windows-10
filedialog
asked on Stack Overflow Jan 25, 2020 by Rotax • edited Jan 25, 2020 by Rotax

0 Answers

Nobody has answered this question yet.


User contributions licensed under CC BY-SA 3.0