Resizing a bitmap image that works?

  • Thread starter Thread starter Wacy
  • Start date Start date
W

Wacy

Hi all,

Does anyone know how to resize a bmp image on the compact
Framework? I have spent ages trying and looking for an
answer.

Any help will be appriciated.

I have some code I've been trying to to work:-

Bitmap b1 = new Bitmap("image1.bmp");

Bitmap newImage = new Bitmap(10,10);
Graphics gr = Graphics.FromImage(newImage);

Rectangle newImageSize = new Rectangle(0, 0, 10, 10);
Rectangle oldImageSize = new Rectangle(0, 0, b1.Width,
b1.Height);

gr.DrawImage(b1, imageToDraw, oldImageSize,
GraphicsUnit.Pixel);

pictureBox1.Image = b1;
pictureBox1.Update();

Wacy
 
More example about images:
go to the www.codeppc.com/dotnet french web site and
search "Pex" which is a Picture Explorer I have written
for the .Net CF.

The sources are provided, you'll find some examples about
images processing.

Romu
 
Thanks V. Much Romu,

Followed your advice and with a little tinkering got it
to work.

Cheers

Wacy
 
Back
Top