Reputation: 33
I set this to make the scrollbar invisble to my tablelayoutpanel:
tableLayoutPanel1.AutoScroll = false;
tableLayoutPanel1.HorizontalScroll.Visible = false;
tableLayoutPanel1.HorizontalScroll.Maximum = 0;
tableLayoutPanel1.VerticalScroll.Maximum = 0;
tableLayoutPanel1.VerticalScroll.Visible = false;
tableLayoutPanel1.AutoScroll = true;
How Can I set to button click scrolling to right and left?
I tried this:
int change = tableLayoutPanel1.HorizontalScroll.Value + tableLayoutPanel1.HorizontalScroll.SmallChange * 40; tableLayoutPanel1.AutoScrollPosition = new Point(change, 0);
but it's scrolled only once time.
Upvotes: 0
Views: 77
Reputation: 39152
Do it this way instead:
int change = tableLayoutPanel1.HorizontalScroll.SmallChange * 40;
tableLayoutPanel1.AutoScrollPosition = new Point(Math.Abs(tableLayoutPanel1.AutoScrollPosition.X) + change , 0);
We need Math.Abs()
since the values returned by AutoScrollPosition are negative.
Upvotes: 1