Question System gets halt on Panel scrolling

Kamlesh

New member
Joined
Sep 24, 2014
Messages
1
Programming Experience
5-10
I am using Panel on windows form and adding the controls like Panel, label etc dynamically with keeping AutoScroll property is true.
When number of controls are added and going to scroll down then it scrolled but my system gets completely in halt position. No works will carry out and after sometime system comes in working.
Why this is happening?
Here is code.

for (int i = 0; i < drs.Length; i++) {
Panel pnl001 = new Panel() {
Location = new Point(0, (pnlBase.Controls.Count == 0 ? 0 : pnlBase.Controls[pnlBase.Controls.Count - 1].Top + pnlBase.Controls[0].Height)),
Width = 1500,
Height = 20,
BackColor = Color.LightGreen
};
pnl001.Controls.Add(new Label() {
Location = new Point(0, 0),
Height = pnl001.Height,
Width = 80,
BackColor = Color.LightGray,
Text = Lineno.ToString(),
TextAlign = ContentAlignment.MiddleLeft
});
pnlBase.Controls.Add(new Label() {
Location = new Point(pnlBase.Controls[0].Width, 0),
Height = pnlBase.Height,
AutoSize = true,
Text = "Line"
});


I repeat, I am facing the issue with scrolling. On scrolling, the system gets halt.
 
Top Bottom