mirror of https://gitlab.com/basile.b/dexed.git
avoid too much allocs on software start-up
- this funct will be used a lot in the widget constructors
This commit is contained in:
parent
e6659329c9
commit
87fa0333fa
|
@ -9,27 +9,25 @@ procedure AssignPng(ctrl: TControl; const resName: string);
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
procedure AssignPng(ctrl: TControl; const resName: string);
|
|
||||||
var
|
var
|
||||||
png : TPortableNetworkGraphic;
|
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;
|
|
||||||
|
|
||||||
|
procedure AssignPng(ctrl: TControl; 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);
|
||||||
|
except
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
initialization
|
initialization
|
||||||
|
png := TPortableNetworkGraphic.Create;
|
||||||
{$I ../src/ce_icons.inc}
|
{$I ../src/ce_icons.inc}
|
||||||
|
finalization
|
||||||
|
png.Free;
|
||||||
end.
|
end.
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue