Using Images in vb.net

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

H

I'm writing a control which has a property called Picture of type Image. Once an image has been assigned to the property (no problems there) I need to split it up into a number of sub images e.g. cut it into 4 equal pieces, which is what I'm having problems with

I've been looking at the various System.Drawing... namespaces but haven't found anything that'll do this or, at least, if it's there I've missed it

Have I missed comething really obvious? How do I do this

Many thank

Ala
 
Hi

I'm writing a control which has a property called Picture of type Image.
Once an image has been assigned to the property (no problems there)
I need to split it up into a number of sub images e.g. cut it into
4 equal pieces, which is what I'm having problems with.

I've been looking at the various System.Drawing... namespaces but
haven't found anything that'll do this or, at least, if it's
there I've missed it.

Have I missed comething really obvious? How do I do this?

Check out the overloads on Graphics.DrawImage. One of them allows only
a portion of the image to be drawn -- and you can "draw" on another
image object.
 
* =?Utf-8?B?QWxhbiBMYW1iZXJ0?= said:
I'm writing a control which has a property called Picture of type
Image. Once an image has been assigned to the property (no problems
there) I need to split it up into a number of sub images e.g. cut it
into 4 equal pieces, which is what I'm having problems with.

Have a look at the 'Bitmap' and 'Graphics' classes. You will have to
instantiate bitmaps of appropriate size and then draw the part of the
big image into them ('Graphics.FromImage' -> 'Graphics' object's
'DrawImage' method).
 
Back
Top