问题
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;
来源:https://stackoverflow.com/questions/41201617/get-a-specific-glyph-from-delphi-vcl-style