Recent

Author Topic: [SOLVED]Dynamic Create TBitBtn and assign image from file  (Read 2010 times)

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
[SOLVED]Dynamic Create TBitBtn and assign image from file
« on: September 17, 2014, 10:32:32 pm »
Please see the attached project
what i'm doing wrong ??
Changing the image of the bitbtn is working when the the form is loaded
but is not working when instructed to do so on the create procedure of the form
Thanks in advance
« Last Edit: September 17, 2014, 11:05:16 pm by Never »
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

Blaazen

  • Hero Member
  • *****
  • Posts: 3237
  • POKE 54296,15
    • Eye-Candy Controls
Re: Dynamic Create TBitBtn and assign image from file
« Reply #1 on: September 17, 2014, 10:55:17 pm »
This works:
Code: [Select]
var PNG: TPortableNetworkGraphic;
begin
...
  PNG:=TPortableNetworkGraphic.Create;
  PNG.LoadFromFile('image/AddNew.png');
  loc_btn.Glyph.Assign(PNG);
  FreeAndNil(PNG);
end;
Lazarus 2.3.0 (rev main-2_3-2863...) FPC 3.3.1 x86_64-linux-qt Chakra, Qt 4.8.7/5.13.2, Plasma 5.17.3
Lazarus 1.8.2 r57369 FPC 3.0.4 i386-win32-win32/win64 Wine 3.21

Try Eye-Candy Controls: https://sourceforge.net/projects/eccontrols/files/

Never

  • Sr. Member
  • ****
  • Posts: 409
  • OS:Win7 64bit / Lazarus 1.4
Re: Dynamic Create TBitBtn and assign image from file
« Reply #2 on: September 17, 2014, 11:04:51 pm »
!!!!thank you very much @Blaazen !!!just test it  works fine
Νέπε Λάζαρε λάγγεψων οξωκά ο φίλοσ'ς αραεύσε

 

TinyPortal © 2005-2018