Solved

How does image works in Buttons

Posted on 2004-09-21
7
866 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
Independent Software Vendors: 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!

 
LVL 18

Accepted Solution

by:
JR2003 earned 500 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

The debugging module of the VB 6 IDE can be accessed by way of the Debug menu item. That menu item can normally be found in the IDE's main menu line as shown in this picture.   There is also a companion Debug Toolbar that looks like the followin…
Article by: Martin
Here are a few simple, working, games that you can use as-is or as the basis for your own games. Tic-Tac-Toe This is one of the simplest of all games.   The game allows for a choice of who goes first and keeps track of the number of wins for…
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…
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…

752 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