Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我希望能够在图片框中拖动 100% 缩放的图片:http: //spunit.tk/x/dragpic1.png。
我希望它像 Windows 照片查看器一样工作:http: //spunit.tk/x/dragpic2.png。
这怎么可能?
我相信您需要维护该图片框的坐标,还将其视图样式设置为全图,而不进行任何拉伸。
然后,您将需要三个鼠标事件:鼠标按下、鼠标向上和鼠标移动,您可以在其中获取鼠标坐标并捕获或释放鼠标以根据鼠标增量平移来平移图片框。