如何在Delphi 10 Seattle中设置默认系统样式? [英] How can I set the default system style in Delphi 10 Seattle?

查看:152
本文介绍了如何在Delphi 10 Seattle中设置默认系统样式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将一些可在Delphi XE8中使用的代码移植到Delphi 10 Seattle。

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

此代码设置了程序的默认系统样式,但使用了SetSystemStyle方法

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);


推荐答案

我添加了Default_Style_Block_Pointer:TMemoryStream;到MainForm Var:块

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

我将此代码放在MainForm.OnCreate事件中:

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));

这篇关于如何在Delphi 10 Seattle中设置默认系统样式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆