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
Read "Before You Post" before posting (https://forums.cyotek.com/cyotek-webcopy/before-you-post/). Do not send me private messages. Do not expect instant replies.

All responses are hand crafted. No AI involved. Possibly no I either.

spuuunit

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