To create a stylish form without borders, you must remove the seBorder property from the StyleElements form.
StyleElements := [seFont, seClient];

But you must set this property for each form. If I understand correctly, you want to show a message dialog with a Windows border. In this case, the StyleElements parameter for the form that calls ShowMessage will not affect the dialog box, because it is a completely new form.
What you need to do is set the StyleElements property for the dialog form that Delphi creates from your reach. To do this, you need to create your own StyleHook form and replace TFormStyleHook for all forms.
Just add the following block to your project, and all forms will have a Windows border, without the need to explicitly specify it for each form.
unit WinBorder; interface uses Winapi.Windows, Winapi.Messages, Vcl.Themes, Vcl.Controls, Vcl.Forms; type TWinBorderFormStyleHook = class(TFormStyleHook) protected procedure WndProc(var Message: TMessage); override; public constructor Create(AControl: TWinControl); override; end; implementation constructor TWinBorderFormStyleHook.Create(AControl: TWinControl); begin inherited; OverridePaintNC := false; end; procedure TWinBorderFormStyleHook.WndProc(var Message: TMessage); begin inherited; if Message.Msg = CM_VISIBLECHANGED then begin if (Control is TCustomForm) and (seBorder in TCustomForm(Control).StyleElements) then TCustomForm(Control).StyleElements := [seFont, seClient]; end; end; initialization TCustomStyleEngine.UnRegisterStyleHook(TCustomForm, TFormStyleHook); TCustomStyleEngine.UnRegisterStyleHook(TForm, TFormStyleHook); TCustomStyleEngine.RegisterStyleHook(TCustomForm, TWinBorderFormStyleHook); TCustomStyleEngine.RegisterStyleHook(TForm, TWinBorderFormStyleHook); finalization TCustomStyleEngine.UnRegisterStyleHook(TCustomForm, TWinBorderFormStyleHook); TCustomStyleEngine.UnRegisterStyleHook(TForm, TWinBorderFormStyleHook); TCustomStyleEngine.RegisterStyleHook(TCustomForm, TFormStyleHook); TCustomStyleEngine.RegisterStyleHook(TForm, TFormStyleHook); end.
Dalija prasnikar
source share