ImageViewer that can stretch?

Under the new desktop controls and I think under prior ImageWell was there not a way to stretch an image to fit the size of the control?

Is there a control someone can recommend that does this?

Thanks

You can use a Canvas, but you’ll have to draw the image yourself.

Look at Graphics.DrawPicture and put your code into a Canvas paint event:

Sub Paint ' Paint event for your Canvas.
  g.DrawPicture( Image, 0, 0, Self.Width, Self.Height, 0, 0, Image.Width, Image.Height )
End Sub

assuming you want it to fit the whole Image to the whole Canvas.

1 Like

Thanks Ian, Just a little surprised ImageViewer cannot do it itself.

1 Like

If you are only targeting Mac, you can use this code:

declare sub imageScaling lib "Cocoa" selector "setImageScaling:" (obj as ptr, value as Integer)
imageScaling(ImageViewer1.Handle, 1) //NSImageScaling.scaleAxesIndependently = 1