Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Buttons Buttons Buttons 1

Status
Not open for further replies.

simoncpage

Programmer
Apr 4, 2002
256
GB
Is there anyway to create gif type buttons on a vb form. I.e a image that has a mouseover property etc. Any help on customising buttons would be great!

Thanks
 
Create the button, then right click on the button and select properties. Then select 'Picture' From the list, you can then make the button any picture file you wish, for mouse pointer there is an option on the properties called 'Mouse Pointer'.

Hope this helps

Martin
 
Not what I wanted....found out how now


You will need (1) an image editor such as Photoshop or Paint Shop Pro and (2) some imagination (grin).

Determine what you would like for command button images; should you suffer some creative block visit a site such as for inspiration.

In the image editor, create your buttons - round ones, flat ones as in MS Money - whatever you prefer. Fashion one button for "normal" and another for when the user has clicked the button, as in a mouseover event.

If your buttons are composed of large blocks of single colours, save the image as GIF. If yours is more like a photograph then use JPEGs.

On your VB form create both buttons as images. Name the buttons that which appeals to you; I used as an example "imgCreateTask" for the "normal" button and "imgSelCreateTask" for the clicked button (Sel means "selected").

The latter button must be ".visible = false"

Now the MouseUp and MouseDown procedures are important, "click" is no more.

Private Sub imgCreateTask_MouseDown(Button as Integer ...)
imgCreateTask.Visible = False
imgSelCreateTask.Visible = True
End Sub

Private Sub imgCreateTask_MouseUp(Button as Integer ...)
imgCreateTask.Visible = True
imgSelCreateTask.Visible = False

Select Case Button
Case 1
<put your code here>
Case 2
Beep
<or create a pop up menu for help>
Case 3
Beep
End Select

End Sub

Remember to always place your code in the MouseUp so that your button might return to &quot;normal&quot; and use the Select Case Button so that the right mouse button cannot initiate the same routines as the left; otherwise, you might confuse the users.
 
Simon,

Sounds like &quot;very useful information&quot; - worthy of &quot;checking out&quot;.

Thanks for the contribution !!! ===> STAR :)

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
You can also create a nice little mouseover button highlighter using the mousemove for true custom feel.

imgSelCreateTask2 being the highlighted button image.
-------------------------------------------------

Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgCreateTask.Visible = True
imgSelCreateTask2.Visible = False
End Sub

Private Sub imgCreateTask_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgCreateTask.Visible = False
imgSelCreateTask.Visible = True
End Sub

Private Sub imgCreateTask_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgCreateTask.Visible = False
imgSelCreateTask2.Visible = True
End Sub

Private Sub imgSelCreateTask_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgCreateTask.Visible = True
imgSelCreateTask.Visible = False
End Sub

Private Sub imgSelCreateTask2_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
imgCreateTask.Visible = True
imgSelCreateTask2.Visible = False
imgSelCreateTask.Visible = True
End Sub
------------------------------------------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top