Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Visual Basic Mouse Over Image Question

Posted on 2013-12-09
8
Medium Priority
?
260 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 49

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 49

Expert Comment

by:Martin Liss
ID: 39709898
Let me ask again - can you zip up and attach your project?
0
Technology Partners: 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 49

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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Have you ever wanted to restrict the users input in a textbox to numbers, and while doing that make sure that they can't 'cheat' by pasting in non-numeric text? Of course you can do that with code you write yourself but it's tedious and error-prone …
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
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…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

972 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