Zooming / stretching a picturebox on current mouse position?

前端 未结 2 1970
情歌与酒
情歌与酒 2021-01-14 04:21

Q: How can I implement zooming on current mouse position over a picturebox, something like zooming in Google Maps?

I am designing a simple GIS / ma

2条回答
  •  余生分开走
    2021-01-14 04:39

    the code below zoomed and stretched the pictureBox on the current mouse position

    pictureBox1.Width = (int)(pictureBox1.Width * zoomratio );
    pictureBox1.Height = (int)(pictureBox1.Height * zoomratio );                
    pictureBox1.Top = (int)(e.Y - zoomratio * (e.Y - pictureBox1.Top));
    pictureBox1.Left = (int)(e.X - zoomratio * (e.X - pictureBox1.Left));
    

提交回复
热议问题