Hi @BruceSteersBruceSteers wrote: ↑Saturday 27th January 2024 1:12am
Public Sub Form_Open() ' make Button1.Picture a picture with text below it. MakePictureText(Button1, Picture["icon:/32/alarm"], "Alarm call") End '' Make a picture with text below it. can be used on any object that has a .Text and a .Picture property. Public Sub MakePictureText(Obj As Object, Pic As Picture, Text As String) Dim hIcon As Picture = Pic.Stretch(Obj.Height - Obj.Font.Height - 6) ' stretch the icon to button height lss font height less margin. Dim p As Picture = New Picture(Obj.W, Obj.H, True) ' make a new picture (use transparent arg to fix qt bug) Obj.Text = "" ' make sure Obj has not got text ' use Paint.class to draw the icon and text to the picture Paint.Begin(p) Paint.DrawPicture(hIcon, (Obj.W - hIcon.W) / 2, 4, hIcon.Width, hIcon.Height) Paint.DrawText(Text, 0, hIcon.Height + 3, Obj.Width, Obj.Font.Height, Align.Center) Paint.End Obj.Picture = p ' set the object picture to new pic End
Quick question about your excellent code that works a treat what do I change to make the text a size smaller?