问题
I create Form and I add Panel with Autoscroll is true;
After than , I Add this code;
Int32 _y =0;
progressBarX1.Maximum = 600;
for (int i = 0; i <= 600;i++ )
{
progressBarX1.Value = i;
ButtonX _btn = new ButtonX();
_btn.Click += new EventHandler(_btn_Click);
_btn.Width = 100;
_btn.Visible = true;
_btn.Height = 70;
_btn.Text = i.ToString();
_btn.Left = 0;
_btn.Top = _y;
_y += 80;
panel1.Controls.Add(_btn);
}
I run the project, but in Panel I see just 407 button, I can not move down with vscroll. All rest buttons doesnt show in panel. But the code is add button to panel. And I check with Tab and buttons are there. The problem Panel Scrolling are I think. Max Height is 32500 aproxilamte. So Vscroll down max this 32500 value.
How Can I increase the Autoscroll Height area ?
回答1:
The autoscroll are is not the issue.
Unfortunately the maximum location for a control is 32767 for either x or y. So the panel is drawing all the buttons on top of each other at the highest location.
If you call BringToFront on the last button, it will become visible.
来源:https://stackoverflow.com/questions/7175807/panel-autoscroll-maximum-value