Forum > Other

fpGUI:How to add image for fpgbutton

(1/1)

lazpas:
How do I associate a custom image for fpgbutton?

Thanks for help.

Graham1:
Sorry for such a late reply.

I think you need to start by using the imageconvert tool in FPGUI to change your image into data, for example:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---const  newimg_rotate: array[0..821] of byte = (     $42,$4D,$36,$03,$00,$00,$00,$00,$00,$00,$36,$00,$00,$00,$28,$00,$00,     $00,$10,$00,$00,$00,$10,$00,$00,$00,$01,$00,$18,$00,$00,$00,$00,$00,     $00,$03,$00,$00,$C4,$0E,$00,$00,$C4,$0E,$00,$00,$00,$00,$00,$00,$00,     $00,$00,$00,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$CC,$CC,$CC,$27,$27,$27,$05,$05,$05,$8C,$8C,$8C,$FF,$FF,$FF,$A8,     $A8,$A8,$DA,$DA,$DA,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$A8,$A8,$A8,$DA,$DA,$DA,$B4,$B4,     $B4,$05,$05,$05,$1C,$1C,$1C,$9F,$9F,$9F,$CC,$CC,$CC,$00,$00,$00,$05,     $05,$05,$9F,$9F,$9F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$75,$75,$75,$00,$00,$00,$53,$53,$53,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$89,$89,$89,$0C,$0C,$0C,$75,     $75,$75,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F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,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$E7,$E7,$E7,$00,$00,$00,$1C,     $1C,$1C,$F9,$F9,$F9,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$DE,$DE,     $DE,$BC,$BC,$BC,$E1,$E1,$E1,$FF,$FF,$FF,$4A,$4A,$4A,$00,$00,$00,$89,     $89,$89,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$F9,$F9,$F9,     $72,$72,$72,$4A,$4A,$4A,$27,$27,$27,$05,$05,$05,$00,$00,$00,$00,$00,     $00,$B4,$B4,$B4,$FF,$FF,$FF,$D4,$D4,$D4,$05,$05,$05,$05,$05,$05,$9F,     $9F,$9F,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$53,$53,$53,     $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$21,$21,$21,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$A8,$A8,$A8,$05,$05,$05,$00,$00,$00,$4A,     $4A,$4A,$B0,$B0,$B0,$E1,$E1,$E1,$DE,$DE,$DE,$9F,$9F,$9F,$00,$00,$00,     $00,$00,$00,$00,$00,$00,$00,$00,$00,$89,$89,$89,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$BC,$BC,$BC,$21,$21,$21,$00,$00,$00,$00,     $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,     $00,$00,$00,$05,$05,$05,$EC,$EC,$EC,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$F9,$F9,$F9,$A8,$A8,$A8,$60,$60,$60,$3D,     $3D,$3D,$3D,$3D,$3D,$60,$60,$60,$A8,$A8,$A8,$7B,$7B,$7B,$00,$00,$00,     $60,$60,$60,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,     $FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$FF,$4A,$4A,$4A,$CC,$CC,$CC,     $FF,$FF,$FF,$FF,$FF,$FF);
Then when you create your button you can use:


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---  fpgImages.AddMaskedBMP(     'newimg.rotate',     @newimg_rotate,     sizeof(newimg_rotate), 0,0);   MyButton := TfpgButton.Create(Self);  with MyButton do  begin    Name := 'MyButton';    Left := 10;    Top := 10;    Width := 24;    Height := 24;    Text := '';    ImageName:='newimg.rotate';    ShowImage := True;    ImageLayout:=ilImagetop;  end; 

Navigation

[0] Message Index

Go to full version