4

I am working on a touch screen POS in WinForms.

I have a flowlayoutpanel and add buttons dynamically but I dont want to show a scrollbar.

I use 2 buttons to scroll instead, so please help me how to scroll without showing a scrollbar

iCollect.it Ltd
  • 92,391
  • 25
  • 181
  • 202
kapil
  • 131
  • 1
  • 2
  • 9

2 Answers2

8

Try placing the FlowLayoutPanel inside another panel with these properties:

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

From here, you have to control yourself the location of the FlowLayoutPanel1 inside your panel (which should also have AutoScroll = false;) based on your two buttons.

LarsTech
  • 80,625
  • 14
  • 153
  • 225
  • can i add easing or page scrolling to this. by page scrolling i mean. on click of left oe right. all visible control is scrolled off showing new sets of visible ones – Smith Jul 31 '16 at 19:42
1

Take 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);
        }
    }
}
Andrew Diamond
  • 6,295
  • 1
  • 15
  • 33
kakarott
  • 193
  • 2
  • 9