C# 以编程方式控制FlowLayoutPanel的水平滚动条
我正在尝试实现Shift+MouseWheel以在面板中执行水平滚动。垂直滚动(不按shift键)工作正常。但是Shift+鼠标滚轮可以水平和垂直滚动 我怎么修理它C# 以编程方式控制FlowLayoutPanel的水平滚动条,c#,winforms,scroll,C#,Winforms,Scroll,我正在尝试实现Shift+MouseWheel以在面板中执行水平滚动。垂直滚动(不按shift键)工作正常。但是Shift+鼠标滚轮可以水平和垂直滚动 我怎么修理它 if (shiftKeyPressed) { if (IsGoUp && this.fLayoutPanel.HorizontalScroll.Value > scrollValue) { this.fLayoutPanel.HorizontalScroll.Value
if (shiftKeyPressed)
{
if (IsGoUp && this.fLayoutPanel.HorizontalScroll.Value > scrollValue)
{
this.fLayoutPanel.HorizontalScroll.Value -= scrollValue;
}
if (!IsGoUp && this.fLayoutPanel.HorizontalScroll.Value < this.fLayoutPanel.HorizontalScroll.Maximum - scrollValue)
{
this.fLayoutPanel.HorizontalScroll.Value += scrollValue;
}
}
if(按下Shift键)
{
if(IsGoUp&&this.fLayoutPanel.HorizontalScroll.Value>scrollValue)
{
this.fLayoutPanel.HorizontalScroll.Value-=scrollValue;
}
如果(!IsGoUp&&this.fLayoutPanel.horizontalcoll.Value
到目前为止,我试着记录垂直滚动值,然后再进行设置,但没有成功。可能我应该停止滚动事件触发。@Sinatr winforms如果您做错了,我们看不到您做错了。盲目的猜测是你没听说过。@HansPassant你是对的。。。