delphi - 从 Delphi VCL 样式获取特定字形

标签 delphi vcl-styles

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

最佳答案

要从 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;

enter image description here

关于delphi - 从 Delphi VCL 样式获取特定字形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41201617/

相关文章:

algorithm - 如何同步两个字符串列表中的相等行

Delphi 7、DUnit 和 FastMM 错误地报告字符串

sql-server - Delphi 3 到 SQL 2008

Delphi XE2风格绘画

如果您使用样式,Delphi TListView DoubleBuffered 不起作用

delphi - 如何在 Delphi 调试期间查看通用 tList

Delphi boolean 变量值

delphi - VCL 样式 - 减小了客户端表单大小

使用 VCL 样式时,ListView 行选择在 Icon 周围被切断

delphi - 如何使 TListView 标题标题在 VCL 样式应用程序中居中?