ImageList bitmap strip

D

Dan Buck

I am attempting to add a strip of images to an image list
using the Image Collection Editor. The image strip is a
64x16 bmp and the image size of the ImageList is 16*16.
When I add this bitmap it comes in as a single image. Can
I use the Image Collection Editor to add a bitmap strip
and if so what do I need to do?

Thanks,
Dan
 
J

Jeremy Cowles

Dan Buck said:
I am attempting to add a strip of images to an image list
using the Image Collection Editor. The image strip is a
64x16 bmp and the image size of the ImageList is 16*16.
When I add this bitmap it comes in as a single image. Can
I use the Image Collection Editor to add a bitmap strip
and if so what do I need to do?

Have you checked the .NET docs? I am not sure if you can or not, but I would
start by looking at the class definition.
If there is no automated way of splitting the Bmp strip, you could easily do
it manually by looping through each image:

<pseudo-code disclaimer="beware of bugs">

Sub InsertBmpStrip(strip as Drawing.Bitmap, images as ImageList, cellWidth
as Integer, cellHeight as Integer)
Dim x, y As Integer
Dim bmpCell as Drawing.BitMap
Dim g as Drawing.Graphics
For x = 0 to strip.Width Step cellWidth
For Y = 0 to strip.Height Step cellHeight
bmpCell = New Bitmap(cellWidth, cellHeight, strip.PixelFormat)
g = Drawing.Graphics.FromImage(bmpCell)
g.DrawImage(strip, 0,0,cellWidth, cellHeight)
g.Dispose( )
images.Images.Add( bmpCell )
Next
Next
End Sub

</pseudo-code>

You may also want to check into the AddStrip Function of the
ImageList.Images collection.

HTH,
Jeremy
 
H

Herfried K. Wagner

Hello,

Dan Buck said:
I am attempting to add a strip of images to an image list
using the Image Collection Editor. The image strip is a
64x16 bmp and the image size of the ImageList is 16*16.
When I add this bitmap it comes in as a single image. Can
I use the Image Collection Editor to add a bitmap strip
and if so what do I need to do?

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemwindowsformsim
agelistimagecollectionclassaddstriptopic.asp

Regards,
Herfried K. Wagner
 

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