如何使用鼠标事件移动图片框中的图像
我正在尝试移动图片框中的图像。我在应用程序中添加了面板,并在面板中添加了图片框。我打开了一个图像。如果图像尺寸很大。我想查看图像的特定部分。那么我如何上下移动图像(不使用滚动条)以查看图像的特定部分?
i am trying to move a image in picture box. i added panel to my application and also added picture box in panel. i opened an image.if the image size is big.i want to see the particular portion of image. so how can i move the image up and down (without using scroll bars) to see the particular portion of image?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以添加向左移动、向右移动、向上移动、向下移动等控件以及相关操作,以在图片框中移动图像。下面显示了如何执行此操作以将图像向右移动的示例。您可以通过鼠标按下和鼠标松开事件来实现这些操作,以便用户只需按相应的按钮即可根据需要移动图片。另请注意,一旦达到图像的最大尺寸,您可以将矩形区域更改为图像边界内的区域。
You can add controls like move left, move right, move up, move down with associated actions to move the image within your picturebox. An example of how to do this for moving the image to the right is shown below. You can implement these action with mouse down and mouse up events so that the user just presses the appropriate buttons to move the picture as he wants. Also note that once you reach the maximum dimensions of the image, you can change the rectangular region to that within image bounds.
不确定它是否真的回答了您的问题,但这似乎是使用 反应式扩展的有趣理由(接收)。 此视频很好地展示了这一点stuff 适用于异步事件,例如鼠标输入。
Not sure if it really answers your question, but this seems like a fun reason to play with Reactive Extensions (Rx). This video demonstrates nicely how well this stuff works with asynchronous events like mouse-input.