Mega Code Archive

 
Categories / Delphi / Graphic
 

Draw on a glyph (for beginners)

Title: Draw on a glyph (for beginners) Question: How can I draw on a Glyph of eg a tBitBtn or a tSpeedButton? Answer: Here are just a few lines to show you how. See the line where I put //very important!! Withouit this line, the whole won't work... if ColorDialog1.Execute then with (sender as tBitBtn).glyph do begin width := 26; height := 16; //very important!! canvas.brush.Color := ColorDialog1.color; canvas.rectangle(1,1,16,15); end; Here, put a tColorDialog and a tBitBtn on a form. Then, on the click-event of the tbitbtn, insert those lines of source. As I used with (sender as tBitBtn).glyph do instead of bitbtn1.glyph, you can usae this for several tbitbtns: just have each bitbtn-event click point to the click-event of the first one.... Happy prograasming Omer Y. Can - Holland