日期:2014-05-18 浏览次数:20878 次
int row = 1; int columnNum = 5; int width = 217; int height = 266; int left = 20; int top = 16; for (int z = 0; z < groupPanel5.Controls.Count; z++) { Control c = groupPanel5.Controls[z]; foreach (Control cc in c.Controls) cc.Dispose(); groupPanel5.Controls.RemoveAt(z); c.Dispose(); } groupPanel5.Controls.Clear(); GC.Collect(); foreach (ServersInfo sv in servs) { DevComponents.DotNetBar.PanelEx pe = new DevComponents.DotNetBar.PanelEx(); DevComponents.DotNetBar.Controls.ReflectionImage refimage = new DevComponents.DotNetBar.Controls.ReflectionImage(); refimage.Location = new System.Drawing.Point(0, 0); refimage.Name = "refimage" + sv.ID.ToString(); refimage.Size = new System.Drawing.Size(217, 125); refimage.Tag = pe; pe.Name = "panelEx_Server" + sv.ID.ToString(); pe.Tag = sv; pe.Size = new Size(width, height); if (i % columnNum == 0) { if (i != 0) row++; pe.Location = new Point(left, (row - 1) * height + top * row); } else { if (row == 1) { pe.Location = new Point(i * width + (i + 1) * left, top); } else { pe.Location = new Point((columnNum - (((row * columnNum) - 1) - i) - 1) * width + (columnNum - (((row * columnNum) - 1) - i)) * left, (row - 1) * height + top * row); } } DevComponents.DotNetBar.Controls.ReflectionLabel reflabel_Serverinfo = new DevComponents.DotNetBar.Controls.ReflectionLabel(); reflabel_Serverinfo.Location = new System.Drawing.Point(0, 100); reflabel_Serverinfo.Name = "reflabel" + sv.ID.ToString(); reflabel_Serverinfo.Size = new System.Drawing.Size(217, 65); DevComponents.DotNetBar.Controls.ReflectionLabel reflabel = new DevComponents.DotNetBar.Controls.ReflectionLabel(); reflabel.Location = new System.Drawing.Point(0, 100); reflabel.Name = "reflabel" + sv.ID.ToString(); reflabel.Size = new System.Drawing.Size(217, 63); pe.Controls.Add(reflabel); pe.Controls.Add(reflabel_Serverinfo); pe.Controls.Add(refimage); this.groupPanel5.Controls.Add(pe); Application.DoEvents(); i++; }