//add a line joining fromcam to tocam private void AddLine(int fromcam, int tocam, int argb) { ShapeControl.CustomControl1 ctrl2 = new ShapeControl.CustomControl1(); ctrl2.Name = "line_" + fromcam + "_" + tocam;//ctrllist.Count; ctrl2.MouseDoubleClick += new MouseEventHandler(ctrl2_MouseDoubleClick); ctrl2.MouseEnter += new EventHandler(ctrl2_MouseEnter); ctrl2.MouseLeave += new EventHandler(ctrl2_MouseLeave); setLine(ref ctrl2); // ctrl2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(126)))), Color.Red); ctrl2.Blink = false; ctrl2.Vibrate = false; ctrl2.AnimateBorder = false; ctrl2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); ctrl2.BorderColor = System.Drawing.Color.FromArgb(argb); ctrl2.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; ctrl2.BorderWidth = 8; ctrl2.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Bold); ctrl2.UseGradient = false; ctrl2.Visible = true; ctrllist1.Add(ctrl2); this.panel1.Controls.Add(ctrl2); // ctrl2.SendToBack(); ctrl2.BringToFront(); }
private void checkBoxV_CheckedChanged(object sender, EventArgs e) { string tag = ((Control)sender).Tag.ToString(); Control[] ctrls = this.panel1.Controls.Find("customControl1" + tag, false); if (ctrls.Length > 0) { ShapeControl.CustomControl1 cam = (ShapeControl.CustomControl1)ctrls[0]; cam.Vibrate = ((CheckBox)sender).Checked; } }
void ctrl2_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Button == MouseButtons.Left) { if (ctrlKey && !altKey && !shiftKey) { DialogResult dr = MessageBox.Show(this, "Delete line?", "Delete", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { ctrllist1.Remove((ShapeControl.CustomControl1)sender); panel1.Controls.Remove((ShapeControl.CustomControl1)sender); } ctrlKey = false; return; } if (altKey && !ctrlKey && !shiftKey) { ((ShapeControl.CustomControl1)sender).AnimateBorder = !((ShapeControl.CustomControl1)sender).AnimateBorder; altKey = false; return; } if (!altKey && !ctrlKey && shiftKey) { ShapeControl.CustomControl1 ctrl1 = ((ShapeControl.CustomControl1)sender); var v = ctrl1.Name.Split('_'); string newname = v[0] + "_" + v[2] + "_" + v[1]; ctrl1.Name = newname; setLine(ref ctrl1); shiftKey = false; return; } ((ShapeControl.CustomControl1)sender).BorderColor = getNextColor(); } }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1)); this.panel1 = new System.Windows.Forms.Panel(); this.customControl113 = new ShapeControl.CustomControl1(); this.shapeControl6 = new ShapeControl.CustomControl1(); this.customControl112 = new ShapeControl.CustomControl1(); this.customControl111 = new ShapeControl.CustomControl1(); this.customControl110 = new ShapeControl.CustomControl1(); this.customControl19 = new ShapeControl.CustomControl1(); this.customControl18 = new ShapeControl.CustomControl1(); this.customControl17 = new ShapeControl.CustomControl1(); this.customControl16 = new ShapeControl.CustomControl1(); this.customControl15 = new ShapeControl.CustomControl1(); this.customControl14 = new ShapeControl.CustomControl1(); this.customControl13 = new ShapeControl.CustomControl1(); this.customControl12 = new ShapeControl.CustomControl1(); this.customControl11 = new ShapeControl.CustomControl1(); this.shapeControl5 = new ShapeControl.CustomControl1(); this.shapeControl7 = new ShapeControl.CustomControl1(); this.shapeControl4 = new ShapeControl.CustomControl1(); this.shapeControl3 = new ShapeControl.CustomControl1(); this.shapeControl2 = new ShapeControl.CustomControl1(); this.shapeControl1 = new ShapeControl.CustomControl1(); this.panel1.SuspendLayout(); this.SuspendLayout(); // // panel1 // this.panel1.Controls.Add(this.shapeControl1); this.panel1.Location = new System.Drawing.Point(10, 17); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(294, 338); this.panel1.TabIndex = 2; // // customControl113 // this.customControl113.AnimateBorder = false; this.customControl113.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(175)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(225))))); this.customControl113.Blink = false; this.customControl113.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl113.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl113.BorderWidth = 0; this.customControl113.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl113.Direction = ShapeControl.LineDirection.None; this.customControl113.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl113.Location = new System.Drawing.Point(896, 235); this.customControl113.Name = "customControl113"; this.customControl113.Shape = ShapeControl.ShapeType.Rectangle; this.customControl113.ShapeImage = ((System.Drawing.Image)(resources.GetObject("customControl113.ShapeImage"))); this.customControl113.Size = new System.Drawing.Size(68, 62); this.customControl113.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl113.TabIndex = 21; this.customControl113.Tag2 = ""; this.customControl113.UseGradient = false; this.customControl113.Vibrate = false; // // shapeControl6 // this.shapeControl6.AnimateBorder = false; this.shapeControl6.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(221)))), ((int)(((byte)(152)))), ((int)(((byte)(53))))); this.shapeControl6.Blink = false; this.shapeControl6.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl6.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl6.BorderWidth = 0; this.shapeControl6.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(240)))), ((int)(((byte)(202)))), ((int)(((byte)(91)))), ((int)(((byte)(171))))); this.shapeControl6.Direction = ShapeControl.LineDirection.None; this.shapeControl6.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.shapeControl6.Location = new System.Drawing.Point(323, 262); this.shapeControl6.Name = "shapeControl6"; this.shapeControl6.Shape = ShapeControl.ShapeType.Ellipse; this.shapeControl6.ShapeImage = ((System.Drawing.Image)(resources.GetObject("shapeControl6.ShapeImage"))); this.shapeControl6.Size = new System.Drawing.Size(125, 93); this.shapeControl6.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(53)))), ((int)(((byte)(198)))), ((int)(((byte)(74)))), ((int)(((byte)(0))))); this.shapeControl6.TabIndex = 9; this.shapeControl6.Tag2 = ""; this.shapeControl6.UseGradient = true; this.shapeControl6.Vibrate = false; // // customControl112 // this.customControl112.AnimateBorder = false; this.customControl112.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(126)))), ((int)(((byte)(255))))); this.customControl112.Blink = false; this.customControl112.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl112.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl112.BorderWidth = 0; this.customControl112.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl112.Direction = ShapeControl.LineDirection.None; this.customControl112.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl112.Location = new System.Drawing.Point(762, 104); this.customControl112.Name = "customControl112"; this.customControl112.Shape = ShapeControl.ShapeType.Rectangle; this.customControl112.ShapeImage = ((System.Drawing.Image)(resources.GetObject("customControl112.ShapeImage"))); this.customControl112.Size = new System.Drawing.Size(67, 63); this.customControl112.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl112.TabIndex = 20; this.customControl112.Tag2 = ""; this.customControl112.UseGradient = false; this.customControl112.Vibrate = false; // // customControl111 // this.customControl111.AnimateBorder = false; this.customControl111.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl111.Blink = false; this.customControl111.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl111.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl111.BorderWidth = 0; this.customControl111.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(164)))), ((int)(((byte)(232)))), ((int)(((byte)(0))))); this.customControl111.Direction = ShapeControl.LineDirection.None; this.customControl111.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl111.Location = new System.Drawing.Point(762, 173); this.customControl111.Name = "customControl111"; this.customControl111.Shape = ShapeControl.ShapeType.Rectangle; this.customControl111.ShapeImage = ((System.Drawing.Image)(resources.GetObject("customControl111.ShapeImage"))); this.customControl111.Size = new System.Drawing.Size(67, 56); this.customControl111.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(255)))), ((int)(((byte)(61)))), ((int)(((byte)(0))))); this.customControl111.TabIndex = 19; this.customControl111.Tag2 = ""; this.customControl111.UseGradient = true; this.customControl111.Vibrate = false; // // customControl110 // this.customControl110.AnimateBorder = false; this.customControl110.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl110.Blink = false; this.customControl110.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl110.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl110.BorderWidth = 0; this.customControl110.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(164)))), ((int)(((byte)(232)))), ((int)(((byte)(0))))); this.customControl110.Direction = ShapeControl.LineDirection.None; this.customControl110.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl110.Location = new System.Drawing.Point(905, 172); this.customControl110.Name = "customControl110"; this.customControl110.Shape = ShapeControl.ShapeType.Rectangle; this.customControl110.ShapeImage = ((System.Drawing.Image)(resources.GetObject("customControl110.ShapeImage"))); this.customControl110.Size = new System.Drawing.Size(67, 56); this.customControl110.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(255)))), ((int)(((byte)(61)))), ((int)(((byte)(0))))); this.customControl110.TabIndex = 18; this.customControl110.Tag2 = ""; this.customControl110.UseGradient = true; this.customControl110.Vibrate = false; // // customControl19 // this.customControl19.AnimateBorder = false; this.customControl19.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl19.Blink = false; this.customControl19.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl19.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl19.BorderWidth = 0; this.customControl19.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(76)))), ((int)(((byte)(164)))), ((int)(((byte)(232)))), ((int)(((byte)(0))))); this.customControl19.Direction = ShapeControl.LineDirection.None; this.customControl19.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl19.Location = new System.Drawing.Point(830, 172); this.customControl19.Name = "customControl19"; this.customControl19.Shape = ShapeControl.ShapeType.Rectangle; this.customControl19.ShapeImage = ((System.Drawing.Image)(resources.GetObject("customControl19.ShapeImage"))); this.customControl19.Size = new System.Drawing.Size(68, 56); this.customControl19.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(110)))), ((int)(((byte)(255)))), ((int)(((byte)(61)))), ((int)(((byte)(0))))); this.customControl19.TabIndex = 17; this.customControl19.Tag2 = ""; this.customControl19.UseGradient = true; this.customControl19.Vibrate = false; // // customControl18 // this.customControl18.AnimateBorder = false; this.customControl18.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl18.Blink = false; this.customControl18.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl18.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl18.BorderWidth = 8; this.customControl18.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl18.Direction = ShapeControl.LineDirection.RightDown; this.customControl18.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl18.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl18.Location = new System.Drawing.Point(640, 122); this.customControl18.Name = "customControl18"; this.customControl18.Shape = ShapeControl.ShapeType.LineVertical; this.customControl18.ShapeImage = null; this.customControl18.Size = new System.Drawing.Size(24, 107); this.customControl18.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl18.TabIndex = 16; this.customControl18.Tag2 = ""; this.customControl18.Text = "customControl18"; this.customControl18.UseGradient = false; this.customControl18.Vibrate = false; // // customControl17 // this.customControl17.AnimateBorder = false; this.customControl17.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl17.Blink = false; this.customControl17.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl17.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl17.BorderWidth = 8; this.customControl17.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl17.Direction = ShapeControl.LineDirection.RightDown; this.customControl17.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl17.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl17.Location = new System.Drawing.Point(646, 226); this.customControl17.Name = "customControl17"; this.customControl17.Shape = ShapeControl.ShapeType.LineDown; this.customControl17.ShapeImage = null; this.customControl17.Size = new System.Drawing.Size(169, 93); this.customControl17.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl17.TabIndex = 15; this.customControl17.Tag2 = ""; this.customControl17.Text = "customControl17"; this.customControl17.UseGradient = false; this.customControl17.Vibrate = false; // // customControl16 // this.customControl16.AnimateBorder = false; this.customControl16.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl16.Blink = false; this.customControl16.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl16.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl16.BorderWidth = 8; this.customControl16.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl16.Direction = ShapeControl.LineDirection.LeftUp; this.customControl16.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl16.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl16.Location = new System.Drawing.Point(640, 58); this.customControl16.Name = "customControl16"; this.customControl16.Shape = ShapeControl.ShapeType.LineHorizontal; this.customControl16.ShapeImage = null; this.customControl16.Size = new System.Drawing.Size(175, 20); this.customControl16.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl16.TabIndex = 14; this.customControl16.Tag2 = ""; this.customControl16.Text = "customControl16"; this.customControl16.UseGradient = false; this.customControl16.Vibrate = false; // // customControl15 // this.customControl15.AnimateBorder = false; this.customControl15.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl15.Blink = false; this.customControl15.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(213)))), ((int)(((byte)(251))))); this.customControl15.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl15.BorderWidth = 4; this.customControl15.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl15.Direction = ShapeControl.LineDirection.None; this.customControl15.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl15.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl15.Location = new System.Drawing.Point(884, 127); this.customControl15.Name = "customControl15"; this.customControl15.Shape = ShapeControl.ShapeType.LineVertical; this.customControl15.ShapeImage = null; this.customControl15.Size = new System.Drawing.Size(24, 144); this.customControl15.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl15.TabIndex = 13; this.customControl15.Tag2 = ""; this.customControl15.Text = "customControl15"; this.customControl15.UseGradient = false; this.customControl15.Vibrate = false; // // customControl14 // this.customControl14.AnimateBorder = false; this.customControl14.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl14.Blink = false; this.customControl14.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(213)))), ((int)(((byte)(251))))); this.customControl14.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl14.BorderWidth = 4; this.customControl14.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl14.Direction = ShapeControl.LineDirection.None; this.customControl14.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl14.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl14.Location = new System.Drawing.Point(774, 226); this.customControl14.Name = "customControl14"; this.customControl14.Shape = ShapeControl.ShapeType.LineHorizontal; this.customControl14.ShapeImage = null; this.customControl14.Size = new System.Drawing.Size(169, 11); this.customControl14.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl14.TabIndex = 12; this.customControl14.Tag2 = ""; this.customControl14.Text = "customControl14"; this.customControl14.UseGradient = false; this.customControl14.Vibrate = false; // // customControl13 // this.customControl13.AnimateBorder = false; this.customControl13.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl13.Blink = false; this.customControl13.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(213)))), ((int)(((byte)(251))))); this.customControl13.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl13.BorderWidth = 4; this.customControl13.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl13.Direction = ShapeControl.LineDirection.None; this.customControl13.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl13.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl13.Location = new System.Drawing.Point(822, 102); this.customControl13.Name = "customControl13"; this.customControl13.Shape = ShapeControl.ShapeType.LineUp; this.customControl13.ShapeImage = null; this.customControl13.Size = new System.Drawing.Size(24, 170); this.customControl13.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl13.TabIndex = 11; this.customControl13.Tag2 = ""; this.customControl13.Text = "customControl13"; this.customControl13.UseGradient = false; this.customControl13.Vibrate = false; // // customControl12 // this.customControl12.AnimateBorder = false; this.customControl12.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl12.Blink = false; this.customControl12.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(213)))), ((int)(((byte)(251))))); this.customControl12.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl12.BorderWidth = 4; this.customControl12.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl12.Direction = ShapeControl.LineDirection.None; this.customControl12.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl12.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl12.Location = new System.Drawing.Point(762, 154); this.customControl12.Name = "customControl12"; this.customControl12.Shape = ShapeControl.ShapeType.LineUp; this.customControl12.ShapeImage = null; this.customControl12.Size = new System.Drawing.Size(180, 27); this.customControl12.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl12.TabIndex = 10; this.customControl12.Tag2 = ""; this.customControl12.Text = "customControl12"; this.customControl12.UseGradient = false; this.customControl12.Vibrate = false; // // customControl11 // this.customControl11.AnimateBorder = false; this.customControl11.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.customControl11.Blink = false; this.customControl11.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl11.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.customControl11.BorderWidth = 0; this.customControl11.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.customControl11.Direction = ShapeControl.LineDirection.None; this.customControl11.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.customControl11.Location = new System.Drawing.Point(478, 127); this.customControl11.Name = "customControl11"; this.customControl11.Shape = ShapeControl.ShapeType.Ellipse; this.customControl11.ShapeImage = null; this.customControl11.Size = new System.Drawing.Size(111, 99); this.customControl11.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(194)))), ((int)(((byte)(255)))), ((int)(((byte)(171)))), ((int)(((byte)(11))))); this.customControl11.TabIndex = 9; this.customControl11.Tag2 = ""; this.customControl11.UseGradient = true; this.customControl11.Vibrate = false; // // shapeControl5 // this.shapeControl5.AnimateBorder = false; this.shapeControl5.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(198)))), ((int)(((byte)(227)))), ((int)(((byte)(251)))), ((int)(((byte)(72))))); this.shapeControl5.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl5.Blink = false; this.shapeControl5.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl5.BorderStyle = System.Drawing.Drawing2D.DashStyle.Dot; this.shapeControl5.BorderWidth = 2; this.shapeControl5.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl5.Direction = ShapeControl.LineDirection.None; this.shapeControl5.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.shapeControl5.Location = new System.Drawing.Point(311, 13); this.shapeControl5.Name = "shapeControl5"; this.shapeControl5.Shape = ShapeControl.ShapeType.BallonSE; this.shapeControl5.ShapeImage = null; this.shapeControl5.Size = new System.Drawing.Size(173, 114); this.shapeControl5.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.shapeControl5.TabIndex = 6; this.shapeControl5.Tag2 = ""; this.shapeControl5.Text = "Hello, I am Tommy"; this.shapeControl5.UseGradient = false; this.shapeControl5.Vibrate = false; this.shapeControl5.Visible = false; // // shapeControl7 // this.shapeControl7.AnimateBorder = false; this.shapeControl7.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(0))))); this.shapeControl7.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl7.Blink = false; this.shapeControl7.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl7.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl7.BorderWidth = 1; this.shapeControl7.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl7.Direction = ShapeControl.LineDirection.None; this.shapeControl7.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.shapeControl7.Location = new System.Drawing.Point(514, 87); this.shapeControl7.Name = "shapeControl7"; this.shapeControl7.Shape = ShapeControl.ShapeType.CustomPolygon; this.shapeControl7.ShapeImage = null; this.shapeControl7.Size = new System.Drawing.Size(27, 24); this.shapeControl7.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(100)))), ((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.shapeControl7.TabIndex = 8; this.shapeControl7.Tag2 = ""; this.shapeControl7.UseGradient = false; this.shapeControl7.Vibrate = false; // // shapeControl4 // this.shapeControl4.AnimateBorder = false; this.shapeControl4.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(92)))), ((int)(((byte)(159)))), ((int)(((byte)(83))))); this.shapeControl4.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl4.Blink = false; this.shapeControl4.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(177)))), ((int)(((byte)(131)))), ((int)(((byte)(255)))), ((int)(((byte)(4))))); this.shapeControl4.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl4.BorderWidth = 3; this.shapeControl4.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl4.Direction = ShapeControl.LineDirection.None; this.shapeControl4.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.shapeControl4.Location = new System.Drawing.Point(473, 253); this.shapeControl4.Name = "shapeControl4"; this.shapeControl4.Shape = ShapeControl.ShapeType.RoundedRectangle; this.shapeControl4.ShapeImage = null; this.shapeControl4.Size = new System.Drawing.Size(116, 38); this.shapeControl4.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.shapeControl4.TabIndex = 5; this.shapeControl4.Tag2 = ""; this.shapeControl4.Text = "Click Me!"; this.shapeControl4.UseGradient = false; this.shapeControl4.Vibrate = false; this.shapeControl4.Click += new System.EventHandler(this.shapeControl4_Click); // // shapeControl3 // this.shapeControl3.AnimateBorder = false; this.shapeControl3.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(124)))), ((int)(((byte)(92)))), ((int)(((byte)(159)))), ((int)(((byte)(83))))); this.shapeControl3.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl3.Blink = false; this.shapeControl3.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(177)))), ((int)(((byte)(131)))), ((int)(((byte)(255)))), ((int)(((byte)(4))))); this.shapeControl3.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl3.BorderWidth = 3; this.shapeControl3.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl3.Direction = ShapeControl.LineDirection.None; this.shapeControl3.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.shapeControl3.Location = new System.Drawing.Point(473, 309); this.shapeControl3.Name = "shapeControl3"; this.shapeControl3.Shape = ShapeControl.ShapeType.RoundedRectangle; this.shapeControl3.ShapeImage = null; this.shapeControl3.Size = new System.Drawing.Size(116, 38); this.shapeControl3.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.shapeControl3.TabIndex = 4; this.shapeControl3.Tag2 = ""; this.shapeControl3.Text = "Close"; this.shapeControl3.UseGradient = false; this.shapeControl3.Vibrate = false; this.shapeControl3.Click += new System.EventHandler(this.shapeControl3_Click); // // shapeControl2 // this.shapeControl2.AnimateBorder = false; this.shapeControl2.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.shapeControl2.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl2.Blink = false; this.shapeControl2.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(118)))), ((int)(((byte)(133)))), ((int)(((byte)(4)))), ((int)(((byte)(9))))); this.shapeControl2.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl2.BorderWidth = 0; this.shapeControl2.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(90)))), ((int)(((byte)(163)))), ((int)(((byte)(126)))), ((int)(((byte)(59))))); this.shapeControl2.Direction = ShapeControl.LineDirection.None; this.shapeControl2.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold); this.shapeControl2.Location = new System.Drawing.Point(434, 76); this.shapeControl2.Name = "shapeControl2"; this.shapeControl2.Shape = ShapeControl.ShapeType.TriangleUp; this.shapeControl2.ShapeImage = null; this.shapeControl2.Size = new System.Drawing.Size(183, 35); this.shapeControl2.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(122)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(255))))); this.shapeControl2.TabIndex = 3; this.shapeControl2.Tag2 = ""; this.shapeControl2.UseGradient = true; this.shapeControl2.Vibrate = false; // // shapeControl1 // this.shapeControl1.AnimateBorder = false; this.shapeControl1.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); this.shapeControl1.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.shapeControl1.Blink = false; this.shapeControl1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(98)))), ((int)(((byte)(255)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl1.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; this.shapeControl1.BorderWidth = 0; this.shapeControl1.CenterColor = System.Drawing.Color.FromArgb(((int)(((byte)(85)))), ((int)(((byte)(255)))), ((int)(((byte)(253)))), ((int)(((byte)(255))))); this.shapeControl1.Direction = ShapeControl.LineDirection.None; this.shapeControl1.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.shapeControl1.ForeColor = System.Drawing.Color.Yellow; this.shapeControl1.Location = new System.Drawing.Point(38, 39); this.shapeControl1.Name = "shapeControl1"; this.shapeControl1.Shape = ShapeControl.ShapeType.Diamond; this.shapeControl1.ShapeImage = null; this.shapeControl1.Size = new System.Drawing.Size(143, 159); this.shapeControl1.SurroundColor = System.Drawing.Color.FromArgb(((int)(((byte)(69)))), ((int)(((byte)(0)))), ((int)(((byte)(0)))), ((int)(((byte)(0))))); this.shapeControl1.TabIndex = 0; this.shapeControl1.Tag2 = ""; this.shapeControl1.Text = "Transparency Test Drag Me Around"; this.shapeControl1.UseGradient = true; this.shapeControl1.Vibrate = false; this.shapeControl1.MouseDown += new System.Windows.Forms.MouseEventHandler(this.shapeControl1_MouseDown); this.shapeControl1.MouseMove += new System.Windows.Forms.MouseEventHandler(this.shapeControl1_MouseMove); // // Form1 // this.AutoScaleBaseSize = new System.Drawing.Size(6, 14); this.BackgroundImageLayout = System.Windows.Forms.ImageLayout.Stretch; this.ClientSize = new System.Drawing.Size(815, 372); this.ControlBox = false; this.Controls.Add(this.customControl113); this.Controls.Add(this.shapeControl6); this.Controls.Add(this.customControl112); this.Controls.Add(this.customControl111); this.Controls.Add(this.customControl110); this.Controls.Add(this.customControl19); this.Controls.Add(this.customControl18); this.Controls.Add(this.customControl17); this.Controls.Add(this.customControl16); this.Controls.Add(this.customControl15); this.Controls.Add(this.customControl14); this.Controls.Add(this.customControl13); this.Controls.Add(this.customControl12); this.Controls.Add(this.customControl11); this.Controls.Add(this.shapeControl5); this.Controls.Add(this.shapeControl7); this.Controls.Add(this.shapeControl4); this.Controls.Add(this.shapeControl3); this.Controls.Add(this.shapeControl2); this.Controls.Add(this.panel1); this.DoubleBuffered = true; this.Name = "Form1"; this.Load += new System.EventHandler(this.Form1_Load); this.panel1.ResumeLayout(false); this.ResumeLayout(false); }
//set position and size for the line shape control private void setLine(ref ShapeControl.CustomControl1 ctrl1) { //note that we want the arrow in the direction of the dest_cam int src_cam, dest_cam; var v = ctrl1.Name.Split('_'); src_cam = int.Parse(v[1]); dest_cam = int.Parse(v[2]); Control[] ctrlsFromcam = this.panel1.Controls.Find("cam" + src_cam, false); Control[] ctrlsTocam = this.panel1.Controls.Find("cam" + dest_cam, false); //src_cam location int x0 = ctrlsFromcam[0].Location.X + ctrlsFromcam[0].Width / 2; int y0 = ctrlsFromcam[0].Location.Y + ctrlsFromcam[0].Height / 2; //dest_cam location int x1 = ctrlsTocam[0].Location.X + ctrlsTocam[0].Width / 2; int y1 = ctrlsTocam[0].Location.Y + ctrlsTocam[0].Height / 2; Control camleft, camright; //set direction base on location of des_cm in relation to src_cam if (x0 <= x1) // dest_cam on the right { camleft = ctrlsFromcam[0]; camright = ctrlsTocam[0]; if (y0 < y1) // dest_cam at the bottom { ctrl1.Direction = ShapeControl.LineDirection.RightDown; } else { ctrl1.Direction = ShapeControl.LineDirection.RightUp; } } else //dest_cam on the left { camright = ctrlsFromcam[0]; camleft = ctrlsTocam[0]; if (y0 < y1) //dest_cam at the bottom { ctrl1.Direction = ShapeControl.LineDirection.LeftDown; } else { ctrl1.Direction = ShapeControl.LineDirection.LeftUp; } } //camleft location int xx0 = camleft.Location.X + camleft.Width / 2; int yy0 = camleft.Location.Y + camleft.Height / 2; //camright location int xx1 = camright.Location.X + camright.Width / 2; int yy1 = camright.Location.Y + camright.Height / 2; float gradient = 0f; //correction when the line adjointing is becoming too steep or level //as these lines are not rendered very well //condition is that x or y delta are within 2 times the border width if (Math.Abs(xx0 - xx1) < (2 * ctrl1.BorderWidth) || Math.Abs(yy0 - yy1) < (2 * ctrl1.BorderWidth)) { ctrl1.Shape = (Math.Abs(xx0 - xx1) < (2 * ctrl1.BorderWidth)) ? ShapeControl.ShapeType.LineVertical : ShapeControl.ShapeType.LineHorizontal; ////set the corrections if (ctrl1.Shape == ShapeControl.ShapeType.LineVertical) { xx0 = xx1; } if (ctrl1.Shape == ShapeControl.ShapeType.LineHorizontal) { yy0 = yy1; } } else { gradient = (float)(yy0 - yy1) / (float)(xx0 - xx1); ctrl1.Shape = (gradient > 0f) ? ShapeControl.ShapeType.LineDown : ShapeControl.ShapeType.LineUp; } //all shape control are specified by //the top-left corner, width and height //lx0,ly0 : location for top-left of shape control //lx1,ly1 : location for bottom-right of shape control //lw: width of shape control //lh: height of shape control int lx0 = 0, ly0 = 0, lx1 = 0, ly1 = 0, lw = 0, lh = 0; switch (ctrl1.Shape) { case ShapeControl.ShapeType.LineVertical: lx0 = xx0 - 10; lx1 = xx1 + 10; ly0 = yy0; ly1 = yy1; //correction when ly0 below ly1 if (ly0 > ly1) { ly0 = yy1; ly1 = yy0; lx0 = xx1 - 10; lx1 = xx0 + 10; } lw = 20; //default width lh = Math.Abs(yy0 - yy1); //min height if (lh < 10) { lh = 10; } break; case ShapeControl.ShapeType.LineHorizontal: ly0 = yy0 - 10; ly1 = yy1 + 10; lx0 = xx0; lx1 = xx1; //default height lh = 20; lw = Math.Abs(xx0 - xx1); //min width if (lw < 10) { lw = 10; } break; case ShapeControl.ShapeType.LineUp: lx0 = xx0; ly0 = yy1; lx1 = xx1; ly1 = yy0; lw = Math.Abs(xx0 - xx1); lh = Math.Abs(yy0 - yy1); //default size: area > 100 if ((lw * lw + lh * lh) < 100) { lh = 10; } break; case ShapeControl.ShapeType.LineDown: lx0 = xx0; ly0 = yy0; lx1 = xx1; ly1 = yy1; lw = Math.Abs(xx0 - xx1); lh = Math.Abs(yy0 - yy1); //default size: area > 100 if ((lw * lw + lh * lh) < 100) { lh = 10; } break; } //we got the corrected location and size, so we set them here ctrl1.Size = new System.Drawing.Size(lw, lh); ctrl1.Location = new Point(lx0, ly0); }
private void ctrl1_MouseDoubleClick(object sender, MouseEventArgs e) { if (e.Clicks < 2) { return; } if (e.Button.Equals(MouseButtons.Left)) { if (plusKey && !minusKey) { if (((ShapeControl.CustomControl1)sender).Width < 80) { ((ShapeControl.CustomControl1)sender).Size = new Size(((ShapeControl.CustomControl1)sender).Width + 5, ((ShapeControl.CustomControl1)sender).Height + 5); } plusKey = false; return; } if (minusKey && !plusKey) { if (((ShapeControl.CustomControl1)sender).Width > 20) { ((ShapeControl.CustomControl1)sender).Size = new Size(((ShapeControl.CustomControl1)sender).Width - 5, ((ShapeControl.CustomControl1)sender).Height - 5); } minusKey = false; return; } if (ctrlKey && !altKey) { DialogResult dr = MessageBox.Show(this, "Delete cam?", "Delete", MessageBoxButtons.OKCancel); if (dr == DialogResult.OK) { //delete all lines connected to the cam int camindex = int.Parse(((ShapeControl.CustomControl1)sender).Name.Substring(3)); linelist = getLines(camindex); for (int i = 0; i < linelist.Count; i++) { ShapeControl.CustomControl1 line = linelist[i]; ctrllist1.Remove(line); panel1.Controls.Remove(line); } ctrllist.Remove((ShapeControl.CustomControl1)sender); panel1.Controls.Remove((ShapeControl.CustomControl1)sender); } ctrlKey = false; return; } if (altKey && !ctrlKey) { ((ShapeControl.CustomControl1)sender).Vibrate = !((ShapeControl.CustomControl1)sender).Vibrate; altKey = false; return; } ((ShapeControl.CustomControl1)sender).BackColor = getNextColor(); } }
//adding a new cam base on caminfo private void AddCam(string caminfo) { bool bNew = (caminfo == ""); string name = ""; string tag = "", tag2 = ""; int x = 0, y = 0, w = 0, h = 0, c = 0; //caminfo format //name=cam1|x=400|y=146|w=40|h=40|c=2130640896|tag=16,-97,359956|tag2=127.0.0.1:New cam if (caminfo != "") { var info = caminfo.Split('|'); for (int i = 0; i < info.Length; i++) { var details = info[i].Split('='); switch (details[0]) { case "name": name = details[1]; break; case "x": x = int.Parse(details[1]); break; case "y": y = int.Parse(details[1]); break; case "w": w = int.Parse(details[1]); break; case "h": h = int.Parse(details[1]); break; case "c": c = int.Parse(details[1]); break; case "tag": tag = details[1]; break; case "tag2": tag2 = details[1]; break; } } } ShapeControl.CustomControl1 ctrl1 = new ShapeControl.CustomControl1(); ctrl1.BackColor = bNew?System.Drawing.Color.FromArgb(((int)(((byte)(126)))), Color.Red):Color.FromArgb(c); ctrl1.Blink = false; ctrl1.BorderColor = System.Drawing.Color.FromArgb(((int)(((byte)(0)))), ((int)(((byte)(255)))), ((int)(((byte)(255)))), ((int)(((byte)(255))))); ctrl1.BorderStyle = System.Drawing.Drawing2D.DashStyle.Solid; ctrl1.BorderWidth = 3; ctrl1.Font = new System.Drawing.Font("Arial", 8f, System.Drawing.FontStyle.Bold); ctrl1.Name = bNew? "cam" + getNextCamIndex():name;//ctrllist.Count; ctrl1.Shape = ShapeControl.ShapeType.Ellipse; ctrl1.ShapeImage = ((System.Drawing.Image)global::TestShapeControl.Properties.Resources.camshape); ctrl1.Size = bNew? new System.Drawing.Size(40, 40):new System.Drawing.Size(w, h); ctrl1.TabIndex = 0; ctrl1.UseGradient = false; ctrl1.Vibrate = false; ctrl1.Visible = true; ctrl1.MouseDown += new MouseEventHandler(ctrl1_MouseDown); ctrl1.MouseMove += new MouseEventHandler(ctrl1_MouseMove); ctrl1.MouseUp += new MouseEventHandler(ctrl1_MouseUp); ctrl1.MouseDoubleClick += new MouseEventHandler(ctrl1_MouseDoubleClick); ctrl1.MouseHover += new EventHandler(ctrl1_MouseHover); //for drag and drop ctrl1.DragEnter += new DragEventHandler(ctrl1_DragEnter); ctrl1.DragDrop += new DragEventHandler(ctrl1_DragDrop); ctrl1.AllowDrop = true; ctrllist.Add(ctrl1); int ypos = (50 * ctrllist.Count) % panel1.Height; int xpos = ((50 * ctrllist.Count) / panel1.Height) * 50; ctrl1.Location = bNew? new System.Drawing.Point(50 + xpos, ypos - 20):new System.Drawing.Point(50, 50); this.panel1.Controls.Add(ctrl1); ctrl1.Text = "cam"; ctrl1.Text = bNew ?(string)ctrl1.Name.ToString().Clone(): name; ctrl1.BringToFront(); ctrl1.Tag2 = bNew? "127.0.0.1:New cam":tag2; //set the color if (bNew) { ctrl1.BackColor = getNextColor(); } float dy = (float)(ctrl1.Top + ctrl1.Height / 2) - (float)panel1.Height / 2; float dx = (float)(ctrl1.Left + ctrl1.Width / 2) - (float)panel1.Width / 2; ctrl1.Tag = bNew? (dx + "," + dy + "," + getNumPixelforImageDisplayed()):tag; }