WinForms 临时禁用面板中的垂直滚动条
我的表单面板中有 MSChart 控件。面板的 AutoScroll 属性设置为 True。一旦图表变得太大 - 用户就可以滚动它。
用户按下 Ctrl+MouseWheel 后,我将启用图表区域的放大/缩小功能。目前在 MouseWheel 上 - 面板和图表都在滚动。当图表处理滚动事件时,如何禁用面板滚动条?
禁用 AutoScroll 属性后,面板将滚动移动到顶部并隐藏垂直滚动条 - 所以这不是我想要的:
void Chart_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control == true)
{
(Parent as Panel).AutoScroll = false;
}
}
void Chart_KeyUp(object sender, KeyEventArgs e)
{
if (e.Control == false)
{
(Parent as Panel).AutoScroll = true;
}
}
我希望面板滚动条在图表缩放(ctrl+鼠标滚轮)时“冻结”并在图表空闲时激活(鼠标滚轮) )。有什么想法吗?
I have MSChart control within Panel in my form. Panel has AutoScroll property set to True. Once the chart gets too big - user is able to scroll through it.
Once user presses Ctrl+MouseWheel I am enabling zoom in/out to the chart area. Currently on MouseWheel - both Panel and Chart are scrolling. How do I disable Panel scrollbars at the time when Chart is handling scrolling events?
After disabling AutoScroll property Panel is moving scroll to the top and hiding vertical scrollbar - so this is not what I want:
void Chart_KeyDown(object sender, KeyEventArgs e)
{
if (e.Control == true)
{
(Parent as Panel).AutoScroll = false;
}
}
void Chart_KeyUp(object sender, KeyEventArgs e)
{
if (e.Control == false)
{
(Parent as Panel).AutoScroll = true;
}
}
I would like Panel scrollbar to "freeze" when chart is zooming (ctrl+mousewheel) and activate when chart is idle (mousewheel). Any ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论