diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs index 74a6354..fc6b1bd 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs @@ -128,6 +128,7 @@ namespace WindowsFormsApplication1 this.label13.Size = new System.Drawing.Size(180, 13); this.label13.TabIndex = 23; this.label13.Text = "ИНФОРМАЦИЯ О ПЕРСОНАЖАХ"; + this.label13.Click += new System.EventHandler(this.label13_Click); // // PictureBoxBackground // @@ -311,6 +312,7 @@ namespace WindowsFormsApplication1 this.TextBoxWall2.Name = "TextBoxWall2"; this.TextBoxWall2.Size = new System.Drawing.Size(100, 20); this.TextBoxWall2.TabIndex = 3; + this.TextBoxWall2.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxWall1_KeyPress); // // TextBoxWall1 // @@ -318,6 +320,7 @@ namespace WindowsFormsApplication1 this.TextBoxWall1.Name = "TextBoxWall1"; this.TextBoxWall1.Size = new System.Drawing.Size(100, 20); this.TextBoxWall1.TabIndex = 2; + this.TextBoxWall1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.TextBoxWall1_KeyPress); // // ComboBoxMove // @@ -436,4 +439,4 @@ namespace WindowsFormsApplication1 private System.Windows.Forms.PictureBox openSpace; private System.Windows.Forms.Label label1; } -} +} \ No newline at end of file diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs index be74dff..35f92f3 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs @@ -97,6 +97,9 @@ namespace WindowsFormsApplication1 private void SaveCharButtonClick(object sender, EventArgs e) { + String[] arr = TextBoxWall1.Text.Split(new String[] { " " }, StringSplitOptions.None); + MessageBox.Show(arr[0]); + persons[nomerPersa].l1 = new Label(); persons[nomerPersa].l1.Top = yPersa; persons[nomerPersa].l1.Left = 30; @@ -131,14 +134,6 @@ namespace WindowsFormsApplication1 new MouseEventHandler(this.button1_Click_2); this.panel1.Controls.Add(persons[nomerPersa].b1); - persons[nomerPersa].b2 = new Button(); - persons[nomerPersa].b2.Top = yPersa; - persons[nomerPersa].b2.Left = 230; - persons[nomerPersa].b2.Width = 50; - persons[nomerPersa].b2.Visible = true; - persons[nomerPersa].b2.Text = "Delete"; - this.panel1.Controls.Add(persons[nomerPersa].b2); - ToolTip tView = new ToolTip(); tView.IsBalloon = true; tView.InitialDelay = 0; @@ -146,13 +141,23 @@ namespace WindowsFormsApplication1 tView.AutoPopDelay = 2000; tView.SetToolTip(persons[nomerPersa].b1, "View/edit person"); + persons[nomerPersa].b2 = new Button(); + persons[nomerPersa].b2.Top = yPersa; + persons[nomerPersa].b2.Left = 230; + persons[nomerPersa].b2.Width = 50; + persons[nomerPersa].b2.Visible = true; + persons[nomerPersa].b2.Text = "Del"; + persons[nomerPersa].b2.Click += + new System.EventHandler(this.label13_Click); + this.panel1.Controls.Add(persons[nomerPersa].b2); + ToolTip tDelete = new ToolTip(); tDelete.IsBalloon = true; tDelete.InitialDelay = 0; tDelete.ShowAlways = true; tDelete.AutoPopDelay = 2000; tDelete.SetToolTip(persons[nomerPersa].b2, "Delete this person"); - + persons[nomerPersa].coord = TextBoxWall1.Text; persons[nomerPersa].coord2 = TextBoxWall2.Text; persons[nomerPersa].nomer = nomerPersa; @@ -160,9 +165,6 @@ namespace WindowsFormsApplication1 nomerPersa++; yPersa = yPersa + 30; openSpace.Image = null; - - - } private void circle_create_person(string filename, string name) @@ -323,7 +325,27 @@ namespace WindowsFormsApplication1 private void label1_Click(object sender, EventArgs e) { + } + private void label13_Click(object sender, EventArgs e) + { + this.panel1.Controls.Remove(persons[nomerPersa - 1].l1); + this.panel1.Controls.Remove(persons[nomerPersa - 1].l2); + this.panel1.Controls.Remove(persons[nomerPersa - 1].l3); + this.panel1.Controls.Remove(persons[nomerPersa - 1].b1); + this.panel1.Controls.Remove(persons[nomerPersa - 1].b2); + nomerPersa--; + yPersa = yPersa - 30; + } + + private void TextBoxWall1_KeyPress(object sender, KeyPressEventArgs e) + { + char c = e.KeyChar; + + if (!(char.IsDigit(c) || c == '\b' || c == ' ')) + { + e.Handled = true; + } } } -} +} \ No newline at end of file