mirror of https://gitlab.com/basile.b/dexed.git
added util function to load shared res to btn
This commit is contained in:
parent
e9ca6f014a
commit
fd54d7c12a
|
@ -3,10 +3,32 @@ unit ce_sharedres;
|
|||
interface
|
||||
|
||||
uses
|
||||
LResources;
|
||||
LResources, Controls, Buttons, Graphics;
|
||||
|
||||
procedure AssignPng(ctrl: TControl; const resName: string);
|
||||
|
||||
implementation
|
||||
|
||||
procedure AssignPng(ctrl: TControl; const resName: string);
|
||||
var
|
||||
png : TPortableNetworkGraphic;
|
||||
begin
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
try
|
||||
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);
|
||||
except
|
||||
end;
|
||||
finally
|
||||
png.Free;
|
||||
end;
|
||||
|
||||
end;
|
||||
|
||||
initialization
|
||||
{$I ../src/ce_icons.inc}
|
||||
end.
|
||||
|
|
Loading…
Reference in New Issue