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.
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
To get a Visual element (glyph) from a VCL Style you must use the GetElementDetails
and the TCustomStyleServices.DrawElement
procedure.
Try this sample
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;