我必须为流布局面板项目创建向上和向下按钮垂直滚动。我该怎么办?我会为POS做这个表格。如何在c#中为流布局面板创建自定义滚动按钮#
我这样做,但它不工作:我有很多按钮,他们有87尺寸高度:我添加了代码和图片。
private void btnScrollUp_Click(object sender, EventArgs e)
{
flowLayoutPanel1.VerticalScroll.Value = flowLayoutPanel1.VerticalScroll.LargeChange-1 ;
flowLayoutPanel1.PerformLayout();
}
private void btnScrollDown_Click(object sender, EventArgs e)
{
flowLayoutPanel1.VerticalScroll.Value = flowLayoutPanel1.VerticalScroll.LargeChange+ 1;
flowLayoutPanel1.PerformLayout();
}
的这不起作用的关键原因之一是你用=代替+ =/- =,但该值的财产行为奇怪与+ =无论如何,看到我的答案下面的一个完整的答案,修复你在这里做了什么:) – chrispepper1989
出于兴趣你为什么要在代码中做它?为什么不使用flowLayoutPanel1.AutoScroll = true; flowLayoutPanel1.VerticalScroll.Visible = true; – chrispepper1989
因为这个程序将使用触摸屏机。所以我必须把大按钮滚动:) –