How can I set the default system style in Delphi 1

2019-08-11 06:16发布

I am trying to port some code that works in Delphi XE8 to Delphi 10 Seattle.

This code sets the default system style of my program, but the SetSystemStyle method does not exist in the Delphi 10 Seattle.

TStyleManager.SetSystemStyle(Self);

1条回答
Fickle 薄情
2楼-- · 2019-08-11 06:55

I added the Default_Style_Block_Pointer: TMemoryStream; to the MainForm Var: block

I placed this code in the MainForm.OnCreate event:

Default_Style_Block_Pointer:=TMemoryStream.Create;
  TStyleStreaming.SaveToStream(TStyleManager.ActiveStyle(Self),Default_Style_Block_Pointer,TStyleFormat.Binary);

I am using this code to restore the default style:

     Default_Style_Block_Pointer.Position:=0; 
        TStyleManager.SetStyle(TStyleStreaming.LoadFromStream(Default_Style_Block_Pointer));
查看更多
登录 后发表回答