Click here to Skip to main content
15,881,173 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Guys,
How Can I scroll a FlowLayout Panel With Using Two Buttons. My FlowLayout Panel Contains UserControls With Picture Boxes. I want to SCroll them Using Two Buttons UP & Down. My is Just Like This,
C#
private void BtnProdUp_Click(object sender, EventArgs e)
        {
                this.FlowProducts.VerticalScroll.Value = this.FlowProducts.VerticalScroll.LargeChange - 1;
                FlowProducts.PerformLayout();

        }

        private void btnProdDown_Click(object sender, EventArgs e)
        {

                 this.FlowProducts.VerticalScroll.Value = this.FlowProducts.VerticalScroll.LargeChange + 1;
                 FlowProducts.PerformLayout();

        }

I dont want Scroll Bar in FlowLayout Panel. My COde Dosen't Work Properly Please Help me Its Very Urgent.
Posted

1 solution

1. insert the FlowLayoutControl with settings:

Dock = DockStyle.None;
AutoScroll = false;
AutoSize = true;
WrapContents = true;
FlowDirection = TopDown

2. into a Panel sized as required
C#
private const int VerticalStep = 40;

private void BtnProdUp_Click(object sender, EventArgs e)
{
    FlowProducts.Top -= VerticalStep ;
}

private void btnProdDown_Click(object sender, EventArgs e)
{
    FlowProducts.Top += VerticalStep ;
}
An alternative I would consider would be to make the FlowLayoutPanel movable by mouse click-drag in the Panel it is sited within ... but, that would take ... time.
 
Share this answer
 
v2
Comments
victowork 12-Nov-14 3:19am    
is worked but i can't set Flowdirection as topdown. It should be LeftToright.
If I set the autosize property=true then arragements of my user controls inside the flowpanel is wrong. It takes more size between one row after another.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900