用于绘制图形和滚动的面板
我希望能够使用 Panel
或类似工具将图形绘制到 Winform 上。如果图形变得大于控件,我似乎看不到任何有关添加滚动条的信息?
是否可以使用 Panel
来执行此操作,或者是否有类似的控件可以实现此目的?
I want to be able to use a Panel
or similar to draw graphics onto a Winform. I cannot seem to see anything regarding adding scrollbars if the graphics become larger than the control?
Is it possible to do this with a Panel
or is there a similar control that will allow it?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
将 AutoScroll 属性设置为 true,并将 AutoScrollMinSize 属性设置为图像的大小。当图像太大时,滚动条现在会自动出现。
您需要从 Panel 继承自己的类,以便可以在构造函数中将 DoubleBuffered 属性设置为 true。否则闪烁会很明显。一些示例代码:
Set the AutoScroll property to true and the AutoScrollMinSize property to the size of the image. The scrollbars will now automatically appear when the image is too large.
You'll want to inherit your own class from Panel so that you can set the DoubleBuffered property to true in the constructor. Flicker would be noticeable otherwise. Some sample code:
我不是 100% 确定你想要完成什么,但这里有一个类似的 这个问题可能对您有帮助。
您还可以尝试使用 PictureBox当图形变大时,您可以手动更改其大小。然后将表单 AutoScroll 设置为 true。
I'm not 100% sure what you're trying to accomplish, but here is a similar SO question that might help you.
You could also try using a PictureBox that you would manually change its size as the graphics get larger. Then set your form AutoScroll to true.