本文介绍了从Delphi VCL样式获取特定字形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想从VCL样式中获取特定的位图-并将其设置为按钮上的图像-它实际上是帮助问号.在位图样式编辑器中是来自窗体的btnHelp图像.
I want to get at a specific bitmap from a VCL style - and set it as an image on a button - it is actually the help question mark. In the Bitmap Style Editor is is the btnHelp image, from the Form.
推荐答案
要从VCL样式获取可视元素(字形),必须使用GetElementDetails
和TCustomStyleServices.DrawElement
过程.
To get a Visual element (glyph) from a VCL Style you must use the GetElementDetails
and the TCustomStyleServices.DrawElement
procedure.
尝试此示例
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 VCL样式获取特定字形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!