从Delphi VCL Style中获取特定的字形

mmm*_*mmm 2 delphi vcl-styles

我想从VCL样式获取特定的位图 - 并将其设置为按钮上的图像 - 它实际上是帮助问号.在位图样式编辑器中是来自Form的btnHelp图像.

RRU*_*RUZ 5

要从VCL样式获取可视元素(字形),您必须使用 GetElementDetailsTCustomStyleServices.DrawElement过程.

试试这个样本

uses
  Vcl.Themes;

{$R *.dfm}

procedure TForm1.PaintBox1Paint(Sender: TObject);
var
  LDetails : TThemedElementDetails;
begin
  //Get the detailsfor the HelpButton
  LDetails := StyleServices.GetElementDetails(twHelpButtonNormal);
  //Draw the the element in the canvas.
  StyleServices.DrawElement(TPaintBox(Sender).Canvas.Handle, LDetails, TPaintBox(Sender).ClientRect);
end;
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述