Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Command Button Image 1

Status
Not open for further replies.

robctech

IS-IT--Management
Oct 12, 2001
114
0
0
CA
OK...I for the life of me have searched and searched but have yet to be able to figure it out...how the #$*@# can I change the size of the image displayed on the command button. I have an app and I'm using just the default traffic lights in the icon directory but every time I select that picture ITS HUGE. I don't want it any larger then a standard icon of 32 x 32 or 16 x 16 as the button its on is small. If I try to use picture.width within command button it is a read only propert and cannot be changed. Any help ASAP would be greatly appreciated.
 
I usually modify the image I want to use to be a 16X16 or 32X32 bitmap using MS photo editor.

If you don't want to do that, try using a picture box instead of a command button; it usually doesn't make a difference unles you;re working with an array of buttons.
 
As far as I can tell, you have to downsize the image in the file it's in, using your favorite image editor. I'm no expert in image editing, but the command button will only show the image as it appears in the file.

Good luck,

Bob
 
Thanks to all those that tried to help but I finally figured out how to do it. Here is the procedure if any of you would like to utilize it.

Add an ImageList to your form. In the properties of the image list use the preset sizes or set a custom image size then in images add the images you want.

then in your code you retrieve the image sized as follows

Code:
command1.Picture = ImageList1.ListImages({key name or index}).ExtractIcon

this works exactly as I wanted it to. if you use Picture instead of ExtractIcon the image appears in its original size
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top