diff --git a/src/ce_sharedres.pas b/src/ce_sharedres.pas index f8ea6d8d..5d8521ce 100644 --- a/src/ce_sharedres.pas +++ b/src/ce_sharedres.pas @@ -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.