Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 290
  • Last Modified:

Image Button Mouseover

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!
0
Shroder
Asked:
Shroder
  • 4
  • 4
1 Solution
 
vinnyd79Commented:
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 #.
0
 
vinnyd79Commented:
What file type are the images? Are they all the same type?
0
 
ShroderAuthor Commented:
They are all jpgs.
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 
ShroderAuthor 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.
0
 
vinnyd79Commented:
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
0
 
ShroderAuthor Commented:
I did a little searching and came to that conclusion. You have verified it. :)

I'm going to try that now.
0
 
vinnyd79Commented:
For starting and stopping gif animations check out Ark's example here:

http://www.freevbcode.com/ShowCode.Asp?ID=758
0
 
ShroderAuthor Commented:
Thank you. I can figure out what's going on with that from the source. :)
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.

  • 4
  • 4
Tackle projects and never again get stuck behind a technical roadblock.
Join Now