2016년 8월 3일 수요일

c# PictureBox Real Position on Not Scaled Image

Point controlRelative = pictureBox1.PointToClient(MousePosition);
Size imageSize = pictureBox1.Image.Size;
Size boxSize = pictureBox1.Size;

Point imagePosition = new Point((imageSize.Width / boxSize.Width) * controlRelative.X,
(imageSize.Height / boxSize.Height) * controlRelative.Y);

댓글 없음:

댓글 쓰기