我想从 VCL 样式获取特定的位图 - 并将其设置为按钮上的图像 - 它实际上是帮助问号。在位图样式编辑器中是来自表单的 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;
关于delphi - 从 Delphi VCL 样式获取特定字形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41201617/