WinForms临时禁用面板中的垂直滚动条

我在表格中的面板中有MSChart控件。 Panel将AutoScroll属性设置为True。 一旦图表变得太大 - 用户可以滚动浏览它。

一旦用户按下Ctrl + MouseWheel,我将启用放大/缩小到图表区域。 目前在MouseWheel上 - 面板和图表都在滚动。 Chart在处理滚动事件时如何禁用Panel滚动条?

禁用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 + mousewheel),我希望面板滚动条“冻结”,当图表空闲时(鼠标滚轮)激活。 有任何想法吗?

链接地址: http://www.djcxy.com/p/53697.html

上一篇: WinForms temporary disable vertical scrollbar in panel

下一篇: Panel not scrolling to focused control when input panel opens