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.
 
Back
Top