开发者

C# Drawing scaled Images JPG, PNG using DrawImage does not look correct

开发者 https://www.devze.com 2023-01-18 18:36 出处:网络
I am trying to Draw an Image (JPG, TIFF, PNG) on the background of my user control. My user control will highlight certain portions of the Image using Rectangles. If I draw the image unscaled they are

I am trying to Draw an Image (JPG, TIFF, PNG) on the background of my user control. My user control will highlight certain portions of the Image using Rectangles. If I draw the image unscaled they are looking correct. But when I draw then Scaled [Fit to Page] then the image is not looking correct. For PNG s开发者_如何学编程ome times it fails to load the image even.

The application is not a image processing app but I still want to show the Image scaled and can see the image properly.

Thanks --HAN


Before Drawing int he paint event I have added the following

        e.Graphics.SmoothingMode = SmoothingMode.HighQuality;
        e.Graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
        e.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality; 

Then the images looked alright.

Thanks for your comments.

--Hari

0

精彩评论

暂无评论...
验证码 换一张
取 消