Solved

Visual Basic Mouse Over Image Question

Posted on 2013-12-09
8
227 Views
Last Modified: 2013-12-22
I have twenty custom button images on a main menu.  Font color black.  Visible=True
I made twenty other identical images directly over each.  Font color yellow. Visible=False
When the mouse passes over a black font button,  I turn the visible property of the yellow button on and off when it hits the regular background.  Works great except that randomly a button blinks instead of just transitioning  smoothly from one font color to the other.  Any suggestions how to correct the occasional blinking or a better technique? Thank You
0
Comment
Question by:GarySB
  • 5
  • 3
8 Comments
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39707841
What kind of buttons are they and can you zip up and attach your project?
0
 

Author Comment

by:GarySB
ID: 39709879
Below are two Subs. The first activates when the mouse passes over a menu selection. I basically swipe out one image for the highlighted one and change it back when the user moves the mouse off of the image.  When I move the mouse over all the buttons, it goes well and then one of the images will completely blink instead of just smoothly changing to the highlighted image I am passing. It seems to happen randomly to any one of them.  I originally tried just turning the visibility value true & false, but I had the same performance result, Thanks for your assistance.

Private Sub LevelClick_cmd_MouseMove(Index As Integer, Button As Integer, Shift As Integer, X As Single, Y As Single)

    ' LevelClick_cmd(20) Images are black font
    ' LevelClick_cmd3(20) Images are yellow font
      
    ' If they are on the same selection then do nothing.
    If SImage = Index Then Exit Sub
   
    ' turn off previous highlighted yellow image
    If SImage > 0 Then
        ' yellow
        LevelClick_cmd(SImage).Picture = ImageTransport.Picture
    End If
   
    SImage = Index  ' set variable to current image mouse is over
           
        ' save original image to put back
        ImageTransport.Picture = LevelClick_cmd(SImage).Picture
      ' now highlight
        LevelClick_cmd(SImage).Picture = LevelClick_cmd3(SImage).Picture

End Sub

(red_img is the menu background)
Private Sub red_img_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)

    ' switch image back to original if user moves mouse off image.
    If SImage > 0 Then
        LevelClick_cmd(SImage).Picture = ImageTransport.Picture
        SImage = 0
    End If

End Sub
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39709898
Let me ask again - can you zip up and attach your project?
0
 

Author Comment

by:GarySB
ID: 39709921
The two Subs I provided are complete.
The actual project is too large, plus the extra code has nothing to do with the main menu image flickering.  Before I did not highlight the command buttons I used when the mouse past over.  I think it looks much better this way.
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:GarySB
ID: 39709926
One other point! I am not using a timer so no delay should be happening.
0
 
LVL 45

Expert Comment

by:Martin Liss
ID: 39709957
Without the actual project I won't be able to see what happens and debug the code. Create a zip file, upload it to www.mediafire.com and post the resulting URL.
0
 

Accepted Solution

by:
GarySB earned 0 total points
ID: 39725605
I deleted the Image objects and replaced them with Picture ones and the blinking is gone. Poor characteristic of the Image performance.
0
 

Author Closing Comment

by:GarySB
ID: 39734474
The Image does not have the quality to clearly swap objects without resulting in blinking.  After many hours of trying I just substituted with Picture objects and they work great.  I could not upload my project as requested, so I had to come up with an alternative.
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
I was working on a PowerPoint add-in the other day and a client asked me "can you implement a feature which processes a chart when it's pasted into a slide from another deck?". It got me wondering how to hook into built-in ribbon events in Office.
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now