cut the part of Bmp?

  • Thread starter Thread starter ekey
  • Start date Start date
E

ekey

Hi:
I want to create Bmp by fellow code,and it good work,

Bitmap bitmap1 = new Bitmap((Image)iData.GetData(DataFormats.Bitmap))

but i want to cut the part of the Bmp now . How to do it ?

for example :

Bitmap bitmap2 = new Bitmap(bitmap1,bitmap1.Width,bitmap1.Height - 100);

but now bitmap2 just is bitmap1,only bitmap2's height is scaled.

THS

Ekey
 
HI,
Try this,
Bitmap bitmap2=new Bitmap(bitmap1.width,bitmap1.height-
100);
Graphics g=Graphics.FromImage(bitmap2);
g.DrawImage(img,new Rectangle
(0,0,bitmap1.width,bitmap1.height-
100),0,0,bitmap1.width,bitmap1.height-
100,GraphicsUnit.Pixel);
g.Save();
bmp.Save("new.bmp",System.Drawing.Imaging.ImageFormat.Bmp);

HTH,
Nanda
-----Original Message-----
Hi:
I want to create Bmp by fellow code,and it good work,

Bitmap bitmap1 = new Bitmap((Image)iData.GetData (DataFormats.Bitmap))

but i want to cut the part of the Bmp now . How to do it ?

for example :

Bitmap bitmap2 = new Bitmap
(bitmap1,bitmap1.Width,bitmap1.Height - 100);
 
Back
Top