我想从VCL样式获取特定的位图 - 并将其设置为按钮上的图像 - 它实际上是帮助问号.在位图样式编辑器中是来自Form的btnHelp图像.
要从VCL样式获取可视元素(字形),您必须使用 GetElementDetails和TCustomStyleServices.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)