Results 1 to 4 of 4

Thread: Coding Java like RollOver effects...

  1. #1

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245
    Earlier in the week Seaweed had given me the following code to allow me the ability to
    use a Mouse Rollover. This was a great function. The problem I am having is that when
    I run my app, the act of MouseOver causes a quick flicker or flash....This will not be
    acceptable for the software I am working on. There must be a better way to code a
    "JAVA like rollover effect", that is efficient, and flicker free?



    Seaweed's code:

    Option Explicit

    Private Sub Form_Load()
    Image1.Visible = False
    End Sub

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

    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As
    Single)
    Image1.Visible = True
    End Sub


    Any help will be greatly appreciated,
    Daniel Christie

  2. #2
    Fanatic Member
    Join Date
    Jan 1999
    Location
    UK
    Posts
    554

    From Vb Sample

    Hi,
    try this code, its not mine...
    its the code in one of the samples that comes with vb


    Private Sub image1_Click()
    ' Refresh the image.
    image1.Refresh
    'place your code here
    Call DoMyProcedure
    'or
    Test=DoMyFunction(SomeParam)
    End Sub

    Private Sub image1_MouseDown(Button As Integer, Shift As Integer, x As Single, Y As Single)
    ' Show the picture for the down state.
    image1.Picture = image1ButtonDn.Picture
    End Sub

    Private Sub image1_MouseMove(Button As Integer, Shift As Integer, x As Single, Y As Single)
    ' If the button is pressed, display the up bitmap
    ' when the mouse is dragged outside the button's area;
    ' otherwise, display the down bitmap.
    Select Case Button
    Case 1
    If x <= 0 Or x > imgFileOpenButton.Width Or Y < 0 Or Y > image1.Height Then
    image1.Picture = image1ButtonUp.Picture
    Else
    image1.Picture = image1ButtonDn.Picture
    End If
    End Select
    End Sub

    Private Sub image1_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)
    ' Show the picture for the up state.
    image1.Picture = image1ButtonUp.Picture
    End Sub


    I hope this helps

    DocZaf
    {;->

    Basically it checks to see if the mouse pointer is directly over the button (in the mousemove event), and if its not then the standard image is automatically implemented.



  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527

    Earlier in the week Seaweed had given me the following code to allow me the ability to
    use a Mouse Rollover. This was a great function. The problem I am having is that when
    I run my app, the act of MouseOver causes a quick flicker or flash....This will not be
    acceptable for the software I am working on. There must be a better way to code a
    "JAVA like rollover effect", that is efficient, and flicker free?



    Seaweed's code:

    Option Explicit

    Private Sub Form_Load()
    Image1.Visible = False
    End Sub

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

    Private Sub Label1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As
    Single)
    Image1.Visible = True
    End Sub


    Any help will be greatly appreciated,
    Daniel Christie

    when the label1 mousemove event is triggered, so is the form mousemove event, so your programs processes are like this

    Mouse Moves
    Label Mousemove Event Raised
    picture.visible = true
    Form Mousemove Event Raised
    picture.visible = false

    i will send you the code, when i work out a way to fix it ok?

  4. #4

    Thread Starter
    Addicted Member Daniel_Christie's Avatar
    Join Date
    Jan 2000
    Location
    USA
    Posts
    245

    Thanks guys.

    Thanks for all of your help guys.

    Daniel christie

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