We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

Image Button Mouseover

Shroder
Shroder asked
on
Medium Priority
310 Views
Last Modified: 2011-09-20
I currently have a button in my VB app that has the image change on mouseover and click. I need to find a way to embed the extra images into my app (like it automaticaly is doing with the initial image) and then still have the mouseovers work (I just need to know how to access the embeded images).

Thanks in adavance!
Comment
Watch Question

Commented:
You can add the images into a resource file as custom resources.Just goto the add-in manager and select resource editor,then under the tools menu select resource editor and add each images as a custom resource then save the changes to the resource file.You can then access the images by their resource #.

Commented:
What file type are the images? Are they all the same type?

Author

Commented:
They are all jpgs.

Author

Commented:
Also, while I have you, do you have any references on starting/stopping gif animations?

I can open a new questionf or this if needed.
Commented:
Im not sure if there is a way to load the jpeg directly to the command button from a resource file. You can do it with bitmaps,icons and cursors. You could create a function or sub to save the jpg to the temp directory,load it then kill the file. Here is an example of that:


Private Sub Form_Load()
' load the image with resource id 101 into Command1
LoadImage Command1, 101
End Sub

Private Sub LoadImage(MyButton As CommandButton, ResId As Long)
Dim bData() As Byte, f As Integer, Tmp As String
f = FreeFile
bData() = LoadResData(ResId, "CUSTOM")
Tmp = Environ("Temp") & "\tmpp.jpg"
Open Tmp For Binary Access Write As #f
Put #f, , bData
Close #f
MyButton.Picture = LoadPicture(Tmp)
Kill Tmp
End Function

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
I did a little searching and came to that conclusion. You have verified it. :)

I'm going to try that now.

Commented:
For starting and stopping gif animations check out Ark's example here:

http://www.freevbcode.com/ShowCode.Asp?ID=758

Author

Commented:
Thank you. I can figure out what's going on with that from the source. :)
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.