Png Resource with tsbitbtn

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #34644
    azrael11
    Participant

    i make a png resource file named glyfs.rc

    GLYF_CONFEDITOR RCDATA confeditor.png

    GLYF_EXTRAFE RCDATA extrafe.png

    …….

    i add it in my project.

    Put a sBitBtn1 and try to load the glyf from resource file sbitbtn1.Glyph.LoadFromResourceName(HInstance,'GLYF_CONFEDITOR');

    when i run i get the error resource file with name 'GLYF_CONFEDITOR' not found.

    What am i doing wrong?

    #46131
    Support
    Keymaster

    Hello

    try such code please :

    Code:
    uses acPNG, CommCtrl;

    procedure TForm1.sButton1Click(Sender: TObject);
    var
    Png : TPNGGraphic;
    rs : TResourceStream;
    Ico : hIcon;
    begin
    Png := TPNGGraphic.Create;
    rs := TResourceStream.Create(hInstance, 'GLYF_CONFEDITOR', RT_RCDATA);
    Png.LoadFromStream(rs);
    rs.Free;
    sbitbtn1.Glyph.Assign(Png);
    Png.Free;
    end;

    #46143
    azrael11
    Participant
    'Support' wrote:

    Hello

    try such code please :

    Code:
    uses acPNG, CommCtrl;

    procedure TForm1.sButton1Click(Sender: TObject);
    var
    Png : TPNGGraphic;
    rs : TResourceStream;
    Ico : hIcon;
    begin
    Png := TPNGGraphic.Create;
    rs := TResourceStream.Create(hInstance, 'GLYF_CONFEDITOR', RT_RCDATA);
    Png.LoadFromStream(rs);
    rs.Free;
    sbitbtn1.Glyph.Assign(Png);
    Png.Free;
    end;

    OK that works great but how can i free the glyph image from sbitbtn1…

    The sbitbtn1.glyph.freeimage not working…

    neither sbitbtn.glyph.empty

    Thanks for your anwser…

    #46094
    Support
    Keymaster

    Try “Glyph.Assign(nil)”

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.