zoukankan      html  css  js  c++  java
  • delphi 通过TStyleManager设置主题类型

    引入

    Vcl.Themes,
    Vcl.Styles,

    设置主题类型

    TStyleManager.TrySetStyle('Turquoise Gray');

    或则在窗体代码中实现

    unit Unit14;

    interface

    uses
    Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes,
    Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Themes,
    Vcl.Styles;

    type
    TForm14 = class(TForm)
      btn1: TButton;
      btn2: TButton;
      lst1: TListBox;
      OpenDialog1: TOpenDialog;
      procedure FormCreate(Sender: TObject);
      procedure btn1Click(Sender: TObject);
    private
      { Private declarations }
      procedure StylesListRefresh();
    public
      { Public declarations }
    end;

    var
      Form14: TForm14;

    implementation

    {$R *.dfm}

    { TForm14 }

    procedure TForm14.btn1Click(Sender: TObject);
    begin
      TStyleManager.SetStyle(lst1.Items[lst1.ItemIndex]);
    end;

    procedure TForm14.FormCreate(Sender: TObject);
    begin
      Self.StylesListRefresh;
    end;

    procedure TForm14.StylesListRefresh;
    var
      stylename: string;
    begin
      Self.lst1.Clear;
      // retrieve all the styles linked in the executable
      for stylename in TStyleManager.StyleNames do
      begin
        lst1.Items.Add(stylename);
      end;
    end;

    end.

  • 相关阅读:
    java循环结构
    java 修饰符
    java变量类型
    java对象和类
    java 环境配置及开发工具
    easy_install 和 pip
    比利牛斯獒犬 flask web
    vim 命令
    vim vi Ubuntu 设置
    Python interview_python
  • 原文地址:https://www.cnblogs.com/yangxuming/p/7346269.html
Copyright © 2011-2022 走看看