private void InitializeUserControls() { foreach (Rectangle r in rli.GetRectangleList()) { Basic_UIPanels customerContrl = new Basic_UIPanels(1); customerContrl.Name = Guid.NewGuid().ToString(); customerContrl.Location = new Point(r.X * xstep + 1, r.Y * ystep + 1); customerContrl.Size = new Size(r.Width * xstep - 1, r.Height * ystep - 1); PackageOfPB ppb = new PackageOfPB(); ppb.Rectitem = new RectItem(r.X, r.Y, r.Width, r.Height); ppb.Bui = customerContrl; customerContrl.Tag = ppb;//记下来该控件所需一些参数,包括摄像机、点位、宽与高、隶属的Usercontrol等等; uclist.Add(customerContrl); packPB.Add(ppb); pictureBox1.Controls.Add(customerContrl); } Invalidate(); }
private void Init() { //Panel p = new Panel(); //p.Location = new Point(100, 100); //Button b1 = new Button(); //b1.Text = "1234567890"; //Button b2 = new Button(); //b2.Text = "asdfasdfasdf"; //p.Controls.Add(b1); //p.Controls.Add(b2); //p.PerformLayout(); //p.Show(); Basic_UIPanels pb4 = new Basic_UIPanels(); pb4.Location = new Point(100, 100); pb4.Size = new Size(400, 300); //Basic_9PannelButtons pb9 = new Basic_9PannelButtons(); //pb9.Location = new Point(400, 400); //pb9.Size = new Size(300, 300); this.Controls.Add(pb4); //this.Controls.Add(pb9); }