Wierd ImageList behavior

H

Harry Simpson

I've added five 41x41 pixel bitmaps to an ImageList. I then
programmatically add different pictures from the imagelist into picture
controls which too are 41x41.

Setting the image propertyy for the pictureboxes works great at design time
but during run time, the images are shrunken to 16x16 pixels before they
appear. If I set the "shrink" they expand but are distorted as if they
really are 16x16 pictures.

Any idea what could be causing this?

TIAM,

Harry
 
H

Harry Simpson

a. Below the image displays just fine in the picturebox (41x41 in a 41x41 picturebox)
b. Add From ImageList button is clicked w/ the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Image = ImageList1.Images(0)
End Sub
And i get the small image which is much smaller.
c. If i change the sizemode from normal to stretchimage, it distorts the image when i load it from the imagelist.



This is got to be a bug right in the control?

Thanks,
Harry
 
H

Harry Simpson

Refreshing when you can answer your own questions.....

Seems the ImageList default size is 16,16 So everything coming out of it is 16,16
So when i say PictureBox1.Image = ImageList1.Images(0) , the image i'm grabbing is a 16x16 image even though the original picture was 41x41.

Only way around this is to set the ImageList ImageSize to whatever you want the picture to be displayed as (ie 41,41)

Thanks
Harry


a. Below the image displays just fine in the picturebox (41x41 in a 41x41 picturebox)
b. Add From ImageList button is clicked w/ the following code:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
PictureBox1.Image = ImageList1.Images(0)
End Sub
And i get the small image which is much smaller.
c. If i change the sizemode from normal to stretchimage, it distorts the image when i load it from the imagelist.



This is got to be a bug right in the control?

Thanks,
Harry
 
S

Serg Kuryata [MS]

Hello Harry,

Yes, you are right. The default size is (16, 16). So, if you do not set the
ImageSize property to a new value, all images that you add to the imagelist
will be resized according to the current value of the property. If you want
to store (41, 41) images, you'll need to set the ImageSize property to (41,
41) before adding any images to the imagelist.

Thank you,
Sergiy.

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
| From: "Harry Simpson" <[email protected]>
| References: <[email protected]>
<[email protected]>
| Subject: Re: Wierd ImageList behavior
| Date: Wed, 28 Apr 2004 16:55:51 -0500
| Lines: 274
| MIME-Version: 1.0
| Content-Type: multipart/related;
| type="multipart/alternative";
| boundary="----=_NextPart_000_0053_01C42D41.AA4F62B0"
| X-Priority: 3
| X-MSMail-Priority: Normal
| X-Newsreader: Microsoft Outlook Express 6.00.2800.1409
| X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409
| Message-ID: <[email protected]>
| Newsgroups: microsoft.public.dotnet.framework.compactframework
| NNTP-Posting-Host: 66.89.73.130.ptr.us.xo.net 66.89.73.130
| Path:
cpmsftngxa10.phx.gbl!TK2MSFTNGXA06.phx.gbl!cpmsftngxa06.phx.gbl!TK2MSFTNGP08
.phx.gbl!TK2MSFTNGP09.phx.gbl
| Xref: cpmsftngxa10.phx.gbl
microsoft.public.dotnet.framework.compactframework:51996
| X-Tomcat-NG: microsoft.public.dotnet.framework.compactframework
|
| Refreshing when you can answer your own questions.....
| Seems the ImageList default size is 16,16 So everything coming out of it
is 16,16
| So when i say PictureBox1.Image = ImageList1.Images(0) , the image i'm
grabbing is a 16x16 image even though the original picture was 41x41.
| Only way around this is to set the ImageList ImageSize to whatever you
want the picture to be displayed as (ie 41,41)
| Thanks
| Harry
| a. Below the image displays just fine in the picturebox (41x41 in a
41x41 picturebox)
| b. Add From ImageList button is clicked w/ the following code:
| Private Sub Button1_Click(ByVal sender As System.Object, ByVal
e As System.EventArgs) Handles Button1.Click
| PictureBox1.Image = ImageList1.Images(0)
| End Sub
| And i get the small image which is much smaller.
| c. If i change the sizemode from normal to stretchimage, it distorts
the image when i load it from the imagelist.
| This is got to be a bug right in the control?
| Thanks,
| Harry
| > I've added five 41x41 pixel bitmaps to an ImageList. I then
| > programmatically add different pictures from the imagelist into
picture
| > controls which too are 41x41.
| >
| > Setting the image propertyy for the pictureboxes works great at
design time
| > but during run time, the images are shrunken to 16x16 pixels before
they
| > appear. If I set the "shrink" they expand but are distorted as if
they
| > really are 16x16 pictures.
| >
| > Any idea what could be causing this?
| >
| > TIAM,
| >
| > Harry
| >
| >
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top