inputpanel打开和关闭的时候有个EnabledChanged时间发生,在这个事件响应函数中添加相应的处理代码就可以了:
private void inputPanel1_EnabledChanged(object sender, EventArgs e)
{
//滚动条
if (this.inputPanel1.Enabled)
{
this.basePanel.AutoScroll = true;
Rectangle rect = this.inputPanel1.VisibleDesktop;
this.basePanel.Height = rect.Height;
}
else {
Rectangle rect = this.inputPanel1.VisibleDesktop;
this.basePanel.Height = rect.Height;
this.basePanel.AutoScroll = false;
}
}
本文介绍了一种在输入面板开启和关闭时调整滚动条及窗口高度的方法。通过监听EnabledChanged事件,实现对输入面板状态变化的响应。当输入面板启用时,设置面板自动滚动并更新高度;禁用时,则关闭自动滚动并保持高度不变。
817





