|
-
Sep 22nd, 2012, 01:05 AM
#1
Thread Starter
Addicted Member
"Hover effect" using picture box control?
Guys, a little help here? I'm trying to make an application that has "button hover" effects, similar to the ones that you normally see in the web. This is how I coded mine:
Code:
Public Class frmModeSelect
Private Sub pcbUserKiosk_MouseHover(ByVal sender As Object, ByVal e As System.EventArgs) Handles pcbUserKiosk.MouseHover
pcbUserKiosk.BackgroundImage = My.Resources.glow_cat
End Sub
Private Sub pcbUserKiosk_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles pcbUserKiosk.MouseLeave
pcbUserKiosk.BackgroundImage = Nothing
End Sub
End Class
pcbUserKiosk by the way is a PictureBox control. You can say that my application is image-heavy, but I really, really want to do this. Anyway, the hover image displays just fine when you hover over the control, but there seems to be a one second lag time. I was wondering how I can eliminate this lag time when the user hovers over the control. What I did, you see, is that there is a background image on the background of the form, and there are a bunch of PictureBoxes on top of the "buttons" in the background image, that would load the hover image. Is this the right way to do it?
Another thing, how can I "reposition" or show which part of an image is shown in the PictureBox control (kindly refer to the second attachment). To better illustrate it, I want the hover and normal states of the "button" in one PNG image, and I want to "reposition"/move the position of the image to the x & y coordinates of the hover state in that image when the user hovers over the control. And can anyone also point me to threads that teach how to skin a form? As usual, thanks.
Last edited by riechan; Sep 22nd, 2012 at 06:06 AM.
====================
ほんとにどもありがとう!
Rie Ishida
-
Sep 22nd, 2012, 11:51 AM
#2
Re: "Hover effect" using picture box control?
Well the obvious way to avoid the lag would be to use the MouseEnter event rather than the Hover which, by definition, has to pause to decide that you are in fact 'hovering'. I don't fully understand the intent or purpose of the varying position but you could presumably achieve this using the margins and padding properties or simply drawing a new bitmap over the control. For form skinning see http://www.vbforums.com/showthread.p...=1#post4222795
As the 6-dimensional mathematics professor said to the brain surgeon, "It ain't Rocket Science!"
Reviews: "dunfiddlin likes his DataTables" - jmcilhinney
Please be aware that whilst I will read private messages (one day!) I am unlikely to reply to anything that does not contain offers of cash, fame or marriage!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|