大家看看,动态加入控件,用了绝对位置,可是会重叠在了一起,可是位置设置的时候是分开的阿,3天结贴,我的信誉大家看着办
呵呵
---------------------------------
foreach (DataRow row in data.Tables[0].Rows)
{
panel1Name = "panel1 " + row[ "roomid "];
panel2Name = "panel2 " + row[ "roomid "];
Panel panel1 = new Panel();
int width;
int height;
width = Convert.ToInt32(row[ "width "]);
height = Convert.ToInt32(row[ "Height "]);
panel1.ID = panel1Name;
panel1.Width = Unit.Pixel(width);
panel1.Height = Unit.Pixel(height);
int rr,gg,bb;
string color;
color = Convert.ToString(row[ "BackColor "]);
rr = Convert.ToInt32(color.Substring(0, 2), 16);
gg = Convert.ToInt32(color.Substring(2, 2), 16);
bb = Convert.ToInt32(color.Substring(4, 2),16);
panel1.BackColor =System.Drawing.Color.FromArgb(rr,gg,bb);
Panel panel2 = new Panel();
panel2.Controls.Add(panel1);
panel2.ID = panel2Name;
panel2.BackColor = panel1.BackColor;
&nb