Results 1 to 6 of 6

Thread: how to use images as buttons?

  1. #1

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Location
    philippines
    Posts
    4

    how to use images as buttons?

    was wondering, how do I use images as buttons? with roll over.
    anybody...please.....?

    Thanks.....

  2. #2
    Fanatic Member sridharavijay's Avatar
    Join Date
    Sep 2002
    Location
    http://www.vijaysridhara.in
    Posts
    589
    use a picturebox and load your picture in that... Use picturebox' properties instead...

    Other wise you can use toolbar where buttons can have pictures..
    Else Command buttons can have pictures on them also

    HTH

  3. #3
    Fanatic Member laserman's Avatar
    Join Date
    Jan 2002
    Location
    Wales U.K
    Posts
    775
    If you want the image to act as a button then just do the following

    Rollover?

    VB Code:
    1. Private Sub Image1_Click()
    2.  
    3. MsgBox ("IMAGE JUST CLICKED"), vbExclamation
    4. End Sub

  4. #4
    Member sahbasita's Avatar
    Join Date
    Feb 2004
    Location
    Loading ...
    Posts
    57

    Try this one !!

    To use image as a button do as Laserman wrote down !

    but, to create it as an rollover button, try this one :

    Dim blnMouseOver as Boolean

    Private Sub Form Load ()

    blnMouseOver = False

    End Sub

    Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    If blnMouseOver Then
    Image1.Picture = App.Path & strFilename 'File of another image to roll over
    End Sub
    BlueE@gles

  5. #5
    Member sahbasita's Avatar
    Join Date
    Feb 2004
    Location
    Loading ...
    Posts
    57
    I'm sorry my last post is interrupted, this is the one i want to share :

    To use image as a button do as Laserman wrote down !

    but, to create it as an rollover button, try this one :

    VB Code:
    1. Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    2.     Image1.Picture = LoadPicture(App.path & your_1st_image_filename)
    3. End Sub
    4.  
    5. Private Sub Image1_Click()
    6.     'put the command you want to insert when the button cliked
    7.     'just like laserman ask you to do
    8. End Sub
    9.  
    10. Private Sub Image1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    11.     If X < Image1.Width And Y < Image1.Height Then
    12.     Image1.Picture = LoadPicture(App.Path & your_2nd_rollover_imagefiles)  'File of another image to roll over
    13.     End If
    14. End Sub


    Hope it helps you.
    BlueE@gles

  6. #6

    Thread Starter
    New Member
    Join Date
    Apr 2004
    Location
    philippines
    Posts
    4

    Wink Thanks a lot....

    Thanks a lot guys, its my third week using VB and it help a lot big time. almost got frustrated..anyway thanks.


    study......study...study......study.....

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width