From c567ff247bf21891d9e25aab63261fc66735327b Mon Sep 17 00:00:00 2001 From: RKQl <32072712+RKQl@users.noreply.github.com> Date: Tue, 10 Apr 2018 16:10:10 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A2=D0=BE=D1=80=D0=BE=D0=BF=D0=BB=D1=8E?= =?UTF-8?q?=D1=81=D1=8C.=20=D0=A0=D0=BE=D0=B7=D0=BE=D0=B2=D0=B0=D1=8F=20?= =?UTF-8?q?=D0=BA=D1=83=D1=80=D1=82=D0=BA=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../MainForm.Designer.cs | 20 ++++++++++--------- .../WindowsFormsApplication1/MainForm.cs | 13 ++++++++++++ 2 files changed, 24 insertions(+), 9 deletions(-) diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs index 7a17f4e..aa97729 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs @@ -41,6 +41,7 @@ namespace WindowsFormsApplication1 this.panel2 = new System.Windows.Forms.Panel(); this.SaveCharButton = new System.Windows.Forms.Button(); this.panel3 = new System.Windows.Forms.Panel(); + this.openSpace = new System.Windows.Forms.PictureBox(); this.SpriteNumberLabel = new System.Windows.Forms.Label(); this.SpriteNumberTextBox = new System.Windows.Forms.TextBox(); this.OpenButton = new System.Windows.Forms.Button(); @@ -59,7 +60,6 @@ namespace WindowsFormsApplication1 this.ButtonAddChar = new System.Windows.Forms.Button(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); - this.openSpace = new System.Windows.Forms.PictureBox(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit(); this.panel2.SuspendLayout(); @@ -209,6 +209,14 @@ namespace WindowsFormsApplication1 this.panel3.TabIndex = 2; this.panel3.Visible = false; // + // openSpace + // + this.openSpace.Location = new System.Drawing.Point(65, 206); + this.openSpace.Name = "openSpace"; + this.openSpace.Size = new System.Drawing.Size(245, 55); + this.openSpace.TabIndex = 17; + this.openSpace.TabStop = false; + // // SpriteNumberLabel // this.SpriteNumberLabel.AutoSize = true; @@ -300,6 +308,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 // @@ -307,6 +316,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 // @@ -357,14 +367,6 @@ namespace WindowsFormsApplication1 // this.openFileDialog1.FileName = "openFileDialog1"; // - // openSpace - // - this.openSpace.Location = new System.Drawing.Point(65, 206); - this.openSpace.Name = "openSpace"; - this.openSpace.Size = new System.Drawing.Size(245, 55); - this.openSpace.TabIndex = 17; - this.openSpace.TabStop = false; - // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs index 484e9eb..ae24e7a 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs @@ -94,6 +94,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; @@ -295,5 +298,15 @@ namespace WindowsFormsApplication1 } } } + + private void TextBoxWall1_KeyPress(object sender, KeyPressEventArgs e) + { + char c = e.KeyChar; + + if (!(char.IsDigit(c) || c == '\b' || c == ' ')) + { + e.Handled = true; + } + } } }