来源https://laorer.iteye.com/blog/654326
实现效果。winfrom界面显示时,滑动鼠标滚动,实现页面滚动
在窗体Load事件手动加载MouseWheel 事件
tableLayoutPanel1.MouseWheel += tableLayoutPanel1_MouseWheel;
private void tableLayoutPanel1_MouseWheel(object sender, MouseEventArgs e)
{
tableLayoutPanel1.Focus();
}
在tableLayoutPanel1控件中选择Scroll事件
private void tableLayoutPanel1_Scroll(object sender, ScrollEventArgs e)
{
tableLayoutPanel1.PerformLayout();
tableLayoutPanel1.Focus();
}
在窗体加载LOad中放入代码 实现进入页面滚动滑轮 实现页面滑动
tableLayoutPanel1.PerformLayout();
tableLayoutPanel1.Focus();
本文介绍了一种在WinForm应用程序中实现鼠标滑轮滚动的方法。通过在Load事件中手动加载MouseWheel事件,并在tableLayoutPanel1控件上设置相应事件处理程序,可以实现在窗口加载时页面响应鼠标滚轮进行滚动。此方法适用于需要在表格布局面板中添加滚动功能的场景。
3万+

被折叠的 条评论
为什么被折叠?



