2015-09-10 67 views
1

我想将Delphi XE8中的一些代码移植到Delphi 10 Seattle。如何在Delphi 10 Seattle中设置默认系统风格?

此代码设置我的程序的默认系统风格,但在Delphi 10 Seattle中不存在SetSystemStyle方法。

TStyleManager.SetSystemStyle(Self); 
+0

对不起,我一直在寻找在错误的地方。该方法已被删除。我不知道如何调整你的代码。它将像'TStyleManager.SetStyle(xxx.GetSystemStyle(yyy))'一样,但我不知道从哪里得到'xxx'和'yyy'。在源代码中查找使用'IStyleBehavior'。像往常一样没有文件。 Embarcadero将在几年的时间内做到这一点。 –

+0

从[此源代码](https://forums.embarcadero.com/thread.jspa?threadID=117396&tstart=1) - “_check the box title ** Enable Runtime Themes ** in the ** Manifest File ** panel of **项目选项**。“ –

+0

@亚历山大否,这是Windows VCL应用程序 –

回答

1

我添加了Default_Style_Block_Pointer:TMemoryStream;到MainForm的VAR:块

我把这个代码在MainForm.OnCreate事件:

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

我使用这个代码来恢复默认样式:

 Default_Style_Block_Pointer.Position:=0; 
     TStyleManager.SetStyle(TStyleStreaming.LoadFromStream(Default_Style_Block_Pointer));