User Tools

Site Tools


displaying_20an_20icon_20on_20a_20pushbutton

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

displaying_20an_20icon_20on_20a_20pushbutton [2018/03/31 13:19]
127.0.0.1 external edit
displaying_20an_20icon_20on_20a_20pushbutton [2018/04/15 19:15] (current)
tbest3112 Added syntax highlighting
Line 2: Line 2:
  
 //by Richard Russell, March 2016//\\ \\  The main //BBC BASIC for Windows// help documentation tells you how to [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​fnbutton|display a BMP image on a pushbutton]] but not how to display an icon (ICO file) instead. The simple code below shows how to do that:​\\ ​ //by Richard Russell, March 2016//\\ \\  The main //BBC BASIC for Windows// help documentation tells you how to [[http://​www.bbcbasic.co.uk/​bbcwin/​manual/​bbcwing.html#​fnbutton|display a BMP image on a pushbutton]] but not how to display an icon (ICO file) instead. The simple code below shows how to do that:​\\ ​
 +<code bb4w>
         BM_SETIMAGE = &F7         BM_SETIMAGE = &F7
         BS_ICON = 64         BS_ICON = 64
Line 22: Line 23:
         PRINT "​Button clicked!"​         PRINT "​Button clicked!"​
         ENDPROC         ENDPROC
 +</​code>​
 This code is for a standalone button displayed in the main window, but can easily be adapted for a button in a dialogue box (change the **SendMessage** call to a **SendDlgItemMessage**).\\ \\  You can similarly display an icon on a **static control** as follows:​\\ ​ This code is for a standalone button displayed in the main window, but can easily be adapted for a button in a dialogue box (change the **SendMessage** call to a **SendDlgItemMessage**).\\ \\  You can similarly display an icon on a **static control** as follows:​\\ ​
 +<code bb4w>
         IMAGE_ICON = 1         IMAGE_ICON = 1
         LR_LOADFROMFILE = 16         LR_LOADFROMFILE = 16
Line 39: Line 42:
         UNTIL FALSE         UNTIL FALSE
         END         END
 +</​code>​
displaying_20an_20icon_20on_20a_20pushbutton.txt ยท Last modified: 2018/04/15 19:15 by tbest3112