Bitmap.HorizontalResolution is read-only.

  • Thread starter Thread starter Olaf Baeyens
  • Start date Start date
O

Olaf Baeyens

To my big suprise HorizontalResolution and VerticalResolution iof the Bitmap
class are read-only!
Is there any reason to this? And How do I change them?

Bitmap bitmap = new Bitmap(imgPhoto.Width,imgPhoto.Height,FileFormat);
bitmap.HorizontalResolution=(float)Resolution.XPixelsInInch;
bitmap.VerticalResolution=(float)Resolution.YPixelsInInch;

Thanks.
 
To my big suprise HorizontalResolution and VerticalResolution iof the
Bitmap
class are read-only!
Is there any reason to this? And How do I change them?

Bitmap bitmap = new Bitmap(imgPhoto.Width,imgPhoto.Height,FileFormat);
bitmap.HorizontalResolution=(float)Resolution.XPixelsInInch;
bitmap.VerticalResolution=(float)Resolution.YPixelsInInch;
Found it:
bitmap.SetResolution((float)Resolution.XPixelsInInch,(float)Resolution.YPixe
lsInInch);

Odd that they made those read-only.
 

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

Back
Top