How to make an user control button with 2 images.. rollover

  • Thread starter Thread starter Marcos Beccar Varela
  • Start date Start date
M

Marcos Beccar Varela

Hello.. can anyone help on how to make a button that has one image an when
mouse over another image like a web rollover?
I need some code if there is availablre.. Thank you all!
Marcos
 
Hello.. can anyone help on how to make a button that has one image an
when mouse over another image like a web rollover?
I need some code if there is availablre.. Thank you all!
Marcos

Private Sub Button1_MouseEnter(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.MouseEnter
Button1.ImageIndex = 1
End Sub

Private Sub Button1_MouseLeave(ByVal sender As Object, ByVal e As
System.EventArgs) Handles Button1.MouseLeave
Button1.ImageIndex = 0
End Sub

If you're doing this at design time, drag an imagelist off the toolbox
onto the form, select the imagelist, right click and select properties,
select images and click on the"..." icon, add the images. Next select
the button in question, right click select properties,then for the
FlatStyle property select anything other than System (If your using XP
or newer and your project has called EnableVisualStyles() than you can't
set this property to System). Next set ImageList property to ImageList1
or whatever you called it in the first step, then set the ImageIndex
property to 0 which we'll call the default state, then just add the code
above to the button events MouseEnter,MouseLeave.

Hope this helps :)
MP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top