面板中的移动图片框
我有一个 C#、WindowsForms 项目,我创建了一个 panel
,其中包含一个 pictureBox
,它比他的父级大得多。
我将 panel.AutoScroll
设置为 true
,我想要做的是将这个 pictureBox
拖到 panel
中,而不是捕获一个卷轴并移动它。
即,当我抓取图像并将光标向左和向下移动时,我希望获得与使用面板滚动条相同的行为。
怎么办呢?
I have a project in C#, WindowsForms and I created a panel
that contains a pictureBox
that is much bigger than his parent.
I turned panel.AutoScroll
to true
and what I want to do is dragging this pictureBox
in panel
instead of catching a scroll and moving it.
I.e. when I grab an image and move cursor to left and down I would like to get the same behavior as I will do it with panel
's scrolls.
How to do it ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
好的,我明白了。 ;-) 如果其他人也有同样的问题,这里是解决方案:
Ok, I got it. ;-) If anyone else has the same problem, here is solution:
hsz 解决方案的较小变体:)
a smaller variant of the hsz solution :)
hsz' 的改进解决方案,具有滚动限制,但我只允许垂直滚动
an improved solution from hsz', with limitation of scroll, but I allow only vertical scroll