Reputation: 100718
Putting custom icons on windows and menus is really simple in WPF, but somehow changing the icon on an OpenFileDialog fto be something other than the application icon is eluding me.
I realize OpenFileDialog() is not creating a WPF control, since it's coming from the Microsoft.Win32 namespace, but there must be a way to set the icon used.
Upvotes: 1
Views: 984
Reputation: 67447
Well if you get the handle of the dialog, you can do it like this:
IntPtr icon=win32.LoadIcon(win32.GetModuleHandle(null), "icon resource name");
win32.SetClassLong(hwnd, GCL_HICON, icon);
Getting the handle is trickier, you have to override WndProc
and watch for messages after creating the dialog.
Upvotes: 1