-- JochenGeorges - 17 Dec 2004

# How to draw a picture on a button

## The Program:

It shows 4 Buttons. The clicked button shows a "Y", the others show an "X".

## The Code:

    STATIC PUBLIC SUB Main()
      DIM myForm AS FMain
      myForm = NEW FMain
      myForm.Show
    END

    PUBLIC SUB btnReset()
      IF Button1.Picture = Picture["y.png"] THEN Button1.Picture = Picture["x.png"]
      IF Button2.Picture = Picture["y.png"] THEN Button2.Picture = Picture["x.png"]
      IF Button3.Picture = Picture["y.png"] THEN Button3.Picture = Picture["x.png"]
      IF Button4.Picture = Picture["y.png"] THEN Button4.Picture = Picture["x.png"]
    END

    PUBLIC SUB Button1_Click()
      btnReset()
      Button1.Picture = Picture["y.png"]
    END

    PUBLIC SUB Button2_Click()
      btnReset()
      Button2.Picture = Picture["y.png"]
    END

    PUBLIC SUB Button3_Click()
      btnReset()
      Button3.Picture = Picture["y.png"]
    END

    PUBLIC SUB Button4_Click()
      btnReset()
      Button4.Picture = Picture["y.png"]
    END

Attachment: | Action: | Size: | Date: | Who: | Comment:
--- | --- | --- | --- | --- | ---
buttonpicture.png | action | 3124 | 17 Dec 2004 - 17:13 | JochenGeorges |
src-buttonpicture.tgz | action | 2578 | 17 Dec 2004 - 17:17 | JochenGeorges |