mirror of https://gitlab.com/basile.b/dexed.git
allow more ctrl types to be assignedto
This commit is contained in:
parent
87fa0333fa
commit
546052732f
|
@ -3,23 +3,25 @@ unit ce_sharedres;
|
|||
interface
|
||||
|
||||
uses
|
||||
LResources, Controls, Buttons, Graphics;
|
||||
LResources, Classes, Controls, Buttons, Graphics;
|
||||
|
||||
procedure AssignPng(ctrl: TControl; const resName: string);
|
||||
procedure AssignPng(ctrl: TPersistent; const resName: string);
|
||||
|
||||
implementation
|
||||
|
||||
var
|
||||
png: TPortableNetworkGraphic;
|
||||
|
||||
procedure AssignPng(ctrl: TControl; const resName: string);
|
||||
procedure AssignPng(ctrl: TPersistent; const resName: string);
|
||||
begin
|
||||
try
|
||||
png.LoadFromLazarusResource(resName);
|
||||
if ctrl is TCustomBitBtn then
|
||||
TCustomBitBtn(ctrl).Glyph.Assign(png)
|
||||
else if ctrl is TCustomSpeedButton then
|
||||
TCustomSpeedButton(ctrl).Glyph.Assign(png);
|
||||
TCustomSpeedButton(ctrl).Glyph.Assign(png)
|
||||
else if ctrl is TBitmap then
|
||||
TBitmap(ctrl).Assign(png);
|
||||
except
|
||||
end;
|
||||
end;
|
||||
|
|
Loading…
Reference in New Issue