如何在不显示Windows窗体中的滚动条的情况下在flowlayout面板中滚动

我正在使用WinForms中的触摸屏POS。

我有一个flowlayoutpanel并动态添加按钮,但我不想显示滚动条。

我使用2个按钮来滚动,所以请帮我如何滚动而不显示滚动条

取两个按钮btnLeft和btnRight并尝试以下代码:

private void btnLeft_Click(object sender, EventArgs e) { if (flowPanelItemCategory.Location.X <= xpos) { xmin = flowPanelItemCategory.HorizontalScroll.Minimum; if (flowPanelItemCategory.Location.X >= xmin) { xpos -= 100; flowPanelItemCategory.Location = new Point(xpos, 0); } } } private void btnRight_Click(object sender, EventArgs e) { if (flowPanelItemCategory.Location.X <= xpos) { xmax = flowPanelItemCategory.HorizontalScroll.Maximum; if (flowPanelItemCategory.Location.X < xmax) { xpos += 100; flowPanelItemCategory.Location = new Point(xpos, 0); } } } 

尝试将FlowLayoutPanel放在具有以下属性的另一个面板中:

 flowLayoutPanel1.AutoScroll = false; flowLayoutPanel1.AutoSize = true; flowLayoutPanel1.AutoSizeMode = AutoSizeMode.GrowAndShrink; 

从这里开始,您必须根据您的两个按钮控制自己面板内FlowLayoutPanel1的位置(也应该有AutoScroll = false; )。