i'm Trying To Creating a Two Button To Scroll My Panel (Up And Down)
My Scroll DownButton
private void button_Category_Down_Click(object sender, EventArgs e)
{
int CurrentVal = flowLayoutPanel_Categories.VerticalScroll.Value;
if (value > CurrentVal)
{
value = CurrentVal - 75;
return;
}
value += 70;
flowLayoutPanel_Categories.AutoScrollPosition = new Point(0, value);
}
And The Scroll Up Button
private void button_Category_Up_Click(object sender, EventArgs e)
{
if (value <= 0)
{
value = 0;
return;
}
value -= 75;
flowLayoutPanel_Categories.AutoScrollPosition = new Point(0, value);
}
My Codes Are working Fine BUT ONlY If Panel Properties [AutoScroll] is set to true
And when autoscroll is true , the ScrollBar will be Visible
how Can i Have The Scroll Bars
i tried
private const int SB_BOTH = 3;
private const int WM_NCCALCSIZE = 0x83;
[DllImport("user32.dll")]
private static extern int ShowScrollBar(IntPtr hWnd, int wBar, int bShow);
protected override void WndProc(ref Message m)
{
ShowScrollBar(flowLayoutPanel_Categories.Handle, SB_BOTH, 0 /*Hide the ScrollBars*/);
base.WndProc(ref m);
}
but its not working probably
and if i set the autoscroll to false, the buttons will not work
sorry for my bad english, and thanks


