I have the following method that adds an image to a canvas:
Private Sub DoOverlayImage(ByVal myCanvas As ICanvas, ByVal image As System.Drawing.Image)
myCanvas.DrawImage(New Infragistics.Documents.Graphics.Image(myImage), 0, 0, CSng(myImage.Width), CSng(myImage.Height))
End Sub
When I use this code, the image appears larger than it should and it does not look good. How do I convert the image width and height from the System.Drawing.Image object to the proper values so that the image appears the same way as it would appear if added to a picture box or other image control?
What's likely going on here is that since the Documents engine works in Points, not Pixels, the image size is not going to be what you're expecting since you're passing in a pixel-based size. You could use the Infragistics.Documents.Utils.Converter.PixelsToPoints method to convert the Width and Height to Points and then pass that into the DrawImage method.
-Matt