How to scroll a flowlayout panel without displaying a window-shaped scroll bar

I work on a touch screen POS screen in WinForms.

I have a flowlayoutpanel and dynamically add buttons, but I do not want to show the scroll bar.

I use 2 buttons to scroll, so please help me scroll without showing the scroll bar.

+4
source share
2 answers

Take the two buttons btnLeft and btnRight and try this code:

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); } } } 
+1
source

Try placing a FlowLayoutPanel inside another panel with these properties:

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

Here you must control the location of FlowLayoutPanel1 inside your panel (which should also have AutoScroll = false; ) based on two buttons.

+8
source

All Articles