Zooming / stretching a picturebox on current mouse position?

前端 未结 2 1968
情歌与酒
情歌与酒 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:50

    I managed to tweak the calculation of the location in this line of code. It's working fine, it is zooming just the way I need it.

    pbxMapa.Location = new Point(pbxMapa.Location.X + (int)(((pbxMapa.Location.X - mouseXPbx) / 10) * zoomRatio), pbxMapa.Location.Y + (int)(((pbxMapa.Location.Y - mouseYPbx) / 10) * zoomRatio));
    

提交回复
热议问题