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
|
||||
|
||||
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;
|
||||
png: TPortableNetworkGraphic;
|
||||
|
||||
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;
|
||||
|
||||
initialization
|
||||
png := TPortableNetworkGraphic.Create;
|
||||
{$I ../src/ce_icons.inc}
|
||||
finalization
|
||||
png.Free;
|
||||
end.
|
||||
|
||||
|
|
Loading…
Reference in New Issue