I'm pulling my hair out over what should be a simple problem...

I've placed a button (call it ctlButton1) on a form.

I've inserted an image from an imagelist on the button, not as a background
image but just as an image.

I've figured out how to resize the button itself, and in fact I can easily
"anchor" the image (centered) on the button so that regardless of the buttons
size, the image is always centered.

What I cannot do is cause the image to scale along with the size of the button.


My original problem was that I had written an activex control (a virtual
LED) under VB6. During conversion, I discovered that not only was the lightweight
image control gone from vb.net (I like its "stretch" property), and even
though the new picturebox control under vb.net now has this stretch property,
I couldn't figure out how to get my old resource file full of bmps (images
of various colors and shapes for the LED) to work under vb.net. So I decided
to put all of my LED images from the VB6 resource file into an imagelist.

But...guess what.....vb.net's picturebox doesn't support an imagelist, but
label controls and button controls DO. That's why I chose the button control.
I'm using it as a container for my LED image.

But I simply cannot resize the image. When I attempt to do so, I have found
a way that I think should work, but it only appears to resize the button,
and actually makes the button's image disappear.

That code looks like this:

btnLED_ON.ImageList.ImageSize = btnLED_ON.Size

btnLED_ON is the button on which I wish to place the image of a specified
index...say imageindex(41).

What I THINK should happen is that the image on the button should become
the same size as the button itself. Instead, the image on the button disappears
altogether and I'm left with a flat-black button.

Would someone please tell me how stupid I am?

Thanks,
Jim Graham
--
Indiana University Cyclotron Facility
graham@iucf.indiana.edu