Groups | Blog | Home
all groups > dotnet drawing api > july 2003 >

dotnet drawing api : Display Multiple Image Files to Picture Box


Ted
7/14/2003 8:58:05 PM
Would anyone know how to control the display size for
multiple image/jpeg files to a windows form or asp.net
picture box control? The .jpeg files should position or
display side by side. I can pull attachments into a
Picture Box, however I have no control of its display size
or positions in a Picture box if I want to display
multiple images.

thx,
James Westgate
7/16/2003 3:02:11 PM
1. Create a new bitmap object from the bitmap class
2. Create a graphics handle to the bitmap object using
graphics.fromimage
3. Draw your image(s) onto the bitmap using drawimage
4. Draw the bitmap to the picture box.

Hope this helps
James

[quoted text, click to view]
Ted Senior
7/16/2003 5:50:00 PM
Thanks for the reply! However, I don't understand why I am getting an
indexed pixel format at Graphics.FromImage(bitmap) as per Code listed
below.

An unhandled exception of type 'System.Exception' occurred in
system.drawing.dll
Additional information: A Graphics object cannot be created from an
image that has an indexed pixel format.

CODE:
Dim BITMAP = New Bitmap(ws.ResponseSoapContext.Attachments(0).Stream)
Graphics.FromImage(bitmap)
bitmap = Graphics.DrawImage(bitmap, 60, 10)
PictureBox1 = bitmap

Ted

*** Sent via Developersdex http://www.developersdex.com ***
AddThis Social Bookmark Button