picture location & picture size

Started by spuuunit, April 13, 2020, 10:25:18 AM

Previous topic - Next topic

spuuunit

Hi! I was wondering if it's possible to get the Left and Top for the picture in the imageBox. And also Width and Height. And also set them.

Something like this for example:
// get where the picture is and how big it is
int pic_left = imageBox.Picture.Left();
int pic_top = imageBox.Picture.Top();
int pic_width = imageBox.Picture.Width();
int pic_height = imageBox.Picture.Height();

// set where the picture should be and how big it should be
imageBox.Picture.Left = -50;
imageBox.Picture.Top = 100;
imageBox.Picture.Width = pic_width + 100;
imageBox.Picture.Height = pic_width + 100;

Richard Moss

Hello,

The GetImageViewPort method will return the region where the image will be painted.

You can't set the viewport directly but the AutoScrollPosition allows you to change the horizontal and vertical scrollbar positions, whilst the Zoom property would influence the width of height of the viewport based on the width and the height of the source image.

Regards;
Richard Moss

spuuunit

Thanks for the reply! :) Sorry for late response, I've had much to do.