Solved

Visual Basic Mouse Over Image Question

Posted on 2013-12-09
8
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 5
  • 3
8 Comments
 
LVL 47

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 47

Expert Comment

by:Martin Liss
ID: 39709898
Let me ask again - can you zip up and attach your project?
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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
 

Author Comment

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

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

SharePoint Admin?

Enable Your Employees To Focus On The Core With Intuitive Onscreen Guidance That is With You At The Moment of Need.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article (http://www.experts-exchange.com/A_7811-A-Better-Concatenate-Function.html) for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
If you have ever used Microsoft Word then you know that it has a good spell checker and it may have occurred to you that the ability to check spelling might be a nice piece of functionality to add to certain applications of yours. Well the code that…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
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…

732 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