Expiring Today—Celebrate National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

How does image works in Buttons

Posted on 2004-09-21
7
Medium Priority
?
876 Views
Last Modified: 2013-12-26
Hi everyone: I have few questions about the button image.

1) Let's say if I placed a image for a button, should I have to include this image into the installation directory - I would prefer to insert a image in the button without placing this image into my installtion package...can I do that?

2) How do I do mouse over a button and change the image of that button?

Thanks all, if I am not clear with my question, please ask me......

0
Comment
Question by:neonlights
[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
  • 3
  • 3
7 Comments
 
LVL 4

Expert Comment

by:Kaarthick
ID: 12112876
1) Let's say if I placed a image for a button, should I have to include this image into the installation directory - I would prefer to insert a image in the button without placing this image into my installtion package...can I do that?

                Unless you pack the image along with the installation package , it cannot be accomplished.

2) How do I do mouse over a button and change the image of that button?

             There will be an event listed like onmouse over or onmouse move up for the button toool. Place the code in that methd to change the image. like , cmdButton.imageURL="the path of the image"
0
 
LVL 18

Expert Comment

by:JR2003
ID: 12113198
1) You do not need to include the picture files separately, just add them to an ImageList control on the form. They will then be included in the .exe you build. At design time the images are then stored in the forms 'frx' file

The following code will change the image every time the button is clicked by cycling through the images in the image list. The best type of images to use a re icons as they have a transparent background.

Add a button with its style property set to Graphic.
Add an ImageList and add a few icons to the image list.
Run the project and every time you click the button the image will change.

If you want to change the icon when the mouse is hovering over the button then you'd be better off using a 'toolbar' control as this functionality is built in to it.

JR


Private Sub Command1_Click()

    Static i As Long
    With Command1
        i = (i + 1) Mod ImageList1.ListImages.Count
        .Picture = ImageList1.ListImages.Item(i + 1).Picture
    End With

End Sub
0
 

Author Comment

by:neonlights
ID: 12113249
Thanks JR_2003 for your advice.

questions for you:
1) let's say I have 2 different forms, and they both have different images....should I have to include imagelist on both forms?

2) what do you mean by: "The best type of images to use a re icons as they have a transparent background" - I am using macromedia - fireworks - can use this program to create it?

3) and where is the tool bar?
"If you want to change the icon when the mouse is hovering over the button then you'd be better off using a 'toolbar' control as this functionality is built in to it."

Thanks again.

0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 18

Accepted Solution

by:
JR2003 earned 2000 total points
ID: 12114530
1) you can refer to the images in one form from another form so there is no need to have the image list on both forms. In my projects I often have a form called frmResources that just stoores image lists etc that are used by many forms within the project. This means that you only have to change your images for the project in one place.
To reference the control in another form just prefix the control name with the form name, e.g.:
frmResources.ImageList1.ListImages.Item(i + 1).Picture


2) There are a selection of icons included with VB, you can find these in the "Program files\common\graphics" directory, they are the ones with the '.ico' file extension.
You can use the C++ IDE to edit the icons or download a free icon editor from the internet. I'm not sure if you can use macromedia - fireworks to create them.

3) The toolbar control is in 'Microsoft Windows Common Controls 6.0' which can be selected using ctrl+T in the IDE.
Which version of VB do you have?

0
 

Author Comment

by:neonlights
ID: 12116769
Can I use those ico... are they copy rights? and any help with free icon creators?

Thank you very much

0
 
LVL 18

Expert Comment

by:JR2003
ID: 12117557
You can use those icons, there is no copyright on them.
Do you have Visual C++? If so i would recomend using that.
http://www.iconarchive.com/ has plenty of icons.
0
 

Author Comment

by:neonlights
ID: 12120654
Thank you so much for your help JR2003, the site you gave me was so good. I am using it...I hope no one is going come after me.....

Thanks
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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

I’ve seen a number of people looking for examples of how to access web services from VB6.  I’ve been using a test harness I built in VB6 (using many resources I found online) that I use for small projects to work out how to communicate with web serv…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the utilization of class modules. Class modules can be a powerful tool in Microsoft Access. They allow you to create self-contained objects that encapsulate functionality. They can easily hide the complexity of a process from…
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…
Suggested Courses

730 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