How to disable Vcl Themes for TFileOpenDialog and TOpenDialog ?
I try
procedure TForm1.FormCreate(Sender: TObject);
var
chosenDirectory: String;
openDialog : TFileOpenDialog;
begin
TStyleManager.Engine.RegisterStyleHook(TFileOpenDialog, TStyleHook);
chosenDirectory:='';
try
openDialog:=TFileOpenDialog.Create(Self);
openDialog.Options := [fdoPickFolders];
// var 2
// Not works
//TStyleManager.Engine.RegisterStyleHook(TFileOpenDialog, TStyleHook);
if openDialog.Execute then
chosenDirectory:=openDialog.FileName;
finally
openDialog.Free;
end;
end;
but it's not work. I try variation 2. It's not work too.
The proper way of disable the styling of the common dialogs is removing the shDialogs element of the TStyleManager.SystemHooks property.
TStyleManager.SystemHooks := [shMenus, shToolTips];
It does not work because FileOpenDialog is system windows dialog, rather than implemented in VCL, so you'll need add system hook based on class name. Plus you'll need to add hooks to class names of all Windows controls on this dialog.
Try something like this. Note that this will affect all system dialogs.
TStyleManager.Engine.RegisterSysStyleHook('#32770', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('ReBarWindow32', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('Static', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('Edit', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('ScrollBar', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('ToolbarWindow32', TSysStyleHook);
TStyleManager.Engine.RegisterSysStyleHook('ComboBox', TSysStyleHook);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With