From 6e2fa77eca960465c42ed9546a8991dfba87a151 Mon Sep 17 00:00:00 2001 From: Mikhail Abramov Date: Tue, 24 Apr 2018 18:53:17 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9A=D0=BE=D0=BB=D0=B8=D1=87=D0=B5=D1=81?= =?UTF-8?q?=D1=82=D0=B2=D0=BE=20=D0=BA=D1=80=D1=83=D0=B3=D0=BE=D0=B2=20(?= =?UTF-8?q?=D0=A1=D0=B0=D0=BD=D1=8F)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../WindowsFormsApplication1/Circle.cs | 14 ++-- .../WindowsFormsApplication1/Line.cs | 2 +- .../MainForm.Designer.cs | 69 +++++++++++++------ .../WindowsFormsApplication1/MainForm.cs | 39 +++++++++++ .../WindowsFormsApplication1/Person.cs | 1 + 5 files changed, 96 insertions(+), 29 deletions(-) diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs index a017aad..cd8fc1c 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Circle.cs @@ -15,10 +15,10 @@ namespace WindowsFormsApplication1 File.AppendAllText(filename, " Person " + name + ";" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".texture = txLoadImage(\"Pictures\\\\" + Path.GetFileName(p.adress) + "\");" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); - File.AppendAllText(filename, " " + name + ".x = " + p.x1 + "; " + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".y = " + p.y1 + "; " + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".x2 = " + p.x2 + "; " + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".y2 = " + p.y2 + "; " + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".x = " + p.x1 + "; " + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".y = " + p.y1 + "; " + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".x2 = " + p.x2 + "; " + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".y2 = " + p.y2 + "; " + Environment.NewLine); File.AppendAllText(filename, " " + name + ".angle = 0;" + Environment.NewLine); File.AppendAllText(filename, " " + name + ".nomer_kadra = 0;" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); @@ -27,9 +27,9 @@ namespace WindowsFormsApplication1 public static void MovePerson(string filename, string name, Person p) { File.AppendAllText(filename, " if ((myTime >= " + p.time1 + ") && (myTime <= " + p.time2 + ")) {" + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".angle++;" + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".x = (" + p.x1 + " + " + p.x2 + ")/2 * cos (" + name + ".angle / 10);" + Environment.NewLine); - File.AppendAllText(filename, " " + name + ".y = (" + p.y1 + " + " + p.y2 + ")/2 * sin (" + name + ".angle / 10);" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".angle = " + name + ".angle + 360 / 20 * " + p.circles + " / (" + p.time2 + "-" + p.time1 + ");" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".x = (" + p.x1 + " + " + p.x2 + ")/2 + (" + p.x1 + " - " + p.x2 + ")/2 * cos (" + name + ".angle * 3.1416 / 180);" + Environment.NewLine); + File.AppendAllText(filename, " " + name + ".y = (" + p.y1 + " + " + p.y2 + ")/2 + (" + p.y1 + " - " + p.y2 + ")/2 * sin (" + name + ".angle * 3.1416 / 180);" + Environment.NewLine); File.AppendAllText(filename, " txTransparentBlt(txDC(), " + name + ".x, " + name + ".y, " + p.width + "/" + p.sprite + ", " + p.height + "," + diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Line.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Line.cs index dfbb2d8..d769c27 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/Line.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Line.cs @@ -31,7 +31,7 @@ namespace WindowsFormsApplication1 p.width + "/" + p.sprite + ", " + p.height + "," + name + ".texture, " + - p.width + "/" + p.sprite + " * " + name + ".nomer_kadra, 255, RGB(255, 255, 255));" + Environment.NewLine); + p.width + "/" + p.sprite + " * " + name + ".nomer_kadra, 0, RGB(255, 255, 255));" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); File.AppendAllText(filename, " " + name + ".nomer_kadra++;" + Environment.NewLine); File.AppendAllText(filename, Environment.NewLine); diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs index f3e19c3..8e06320 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.Designer.cs @@ -63,6 +63,8 @@ namespace WindowsFormsApplication1 this.ButtonAddChar = new System.Windows.Forms.Button(); this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog(); this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog(); + this.textBox1 = new System.Windows.Forms.TextBox(); + this.label2 = new System.Windows.Forms.Label(); this.panel1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.PictureBoxBackground)).BeginInit(); this.panel2.SuspendLayout(); @@ -76,18 +78,18 @@ namespace WindowsFormsApplication1 this.LabelData.Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); this.LabelData.Location = new System.Drawing.Point(0, 9); this.LabelData.Name = "LabelData"; - this.LabelData.Size = new System.Drawing.Size(224, 23); + this.LabelData.Size = new System.Drawing.Size(234, 23); this.LabelData.TabIndex = 0; - this.LabelData.Text = "Данные о мултфильме:"; + this.LabelData.Text = "Данные о мультфильме:"; // // LabelLengh // this.LabelLengh.AutoSize = true; this.LabelLengh.Location = new System.Drawing.Point(14, 60); this.LabelLengh.Name = "LabelLengh"; - this.LabelLengh.Size = new System.Drawing.Size(130, 13); + this.LabelLengh.Size = new System.Drawing.Size(136, 13); this.LabelLengh.TabIndex = 1; - this.LabelLengh.Text = "Длительность: 0 секунд"; + this.LabelLengh.Text = "Длительность: 35 секунд"; // // LabelName // @@ -202,6 +204,8 @@ namespace WindowsFormsApplication1 // // panel3 // + this.panel3.Controls.Add(this.textBox1); + this.panel3.Controls.Add(this.label2); this.panel3.Controls.Add(this.charNameBox); this.panel3.Controls.Add(this.charNameLabel); this.panel3.Controls.Add(this.openSpace); @@ -225,18 +229,20 @@ namespace WindowsFormsApplication1 this.panel3.Size = new System.Drawing.Size(377, 324); this.panel3.TabIndex = 2; this.panel3.Visible = false; + this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint); // // charNameBox // - this.charNameBox.Location = new System.Drawing.Point(85, 115); + this.charNameBox.Location = new System.Drawing.Point(85, 88); this.charNameBox.Name = "charNameBox"; this.charNameBox.Size = new System.Drawing.Size(138, 20); this.charNameBox.TabIndex = 19; + this.charNameBox.TextChanged += new System.EventHandler(this.charNameBox_TextChanged); // // charNameLabel // this.charNameLabel.AutoSize = true; - this.charNameLabel.Location = new System.Drawing.Point(19, 115); + this.charNameLabel.Location = new System.Drawing.Point(19, 88); this.charNameLabel.Name = "charNameLabel"; this.charNameLabel.Size = new System.Drawing.Size(60, 13); this.charNameLabel.TabIndex = 18; @@ -244,7 +250,7 @@ namespace WindowsFormsApplication1 // // openSpace // - this.openSpace.Location = new System.Drawing.Point(188, 189); + this.openSpace.Location = new System.Drawing.Point(185, 193); this.openSpace.Name = "openSpace"; this.openSpace.Size = new System.Drawing.Size(186, 72); this.openSpace.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; @@ -254,7 +260,7 @@ namespace WindowsFormsApplication1 // SpriteNumberLabel // this.SpriteNumberLabel.AutoSize = true; - this.SpriteNumberLabel.Location = new System.Drawing.Point(7, 153); + this.SpriteNumberLabel.Location = new System.Drawing.Point(4, 157); this.SpriteNumberLabel.Name = "SpriteNumberLabel"; this.SpriteNumberLabel.Size = new System.Drawing.Size(119, 13); this.SpriteNumberLabel.TabIndex = 16; @@ -262,14 +268,14 @@ namespace WindowsFormsApplication1 // // SpriteNumberTextBox // - this.SpriteNumberTextBox.Location = new System.Drawing.Point(10, 169); + this.SpriteNumberTextBox.Location = new System.Drawing.Point(7, 173); this.SpriteNumberTextBox.Name = "SpriteNumberTextBox"; this.SpriteNumberTextBox.Size = new System.Drawing.Size(83, 20); this.SpriteNumberTextBox.TabIndex = 15; // // OpenButton // - this.OpenButton.Location = new System.Drawing.Point(188, 153); + this.OpenButton.Location = new System.Drawing.Point(185, 157); this.OpenButton.Name = "OpenButton"; this.OpenButton.Size = new System.Drawing.Size(192, 30); this.OpenButton.TabIndex = 14; @@ -280,7 +286,7 @@ namespace WindowsFormsApplication1 // LabelPic // this.LabelPic.AutoSize = true; - this.LabelPic.Location = new System.Drawing.Point(129, 153); + this.LabelPic.Location = new System.Drawing.Point(126, 157); this.LabelPic.Name = "LabelPic"; this.LabelPic.Size = new System.Drawing.Size(58, 13); this.LabelPic.TabIndex = 12; @@ -289,7 +295,7 @@ namespace WindowsFormsApplication1 // LabelTime // this.LabelTime.AutoSize = true; - this.LabelTime.Location = new System.Drawing.Point(19, 91); + this.LabelTime.Location = new System.Drawing.Point(19, 64); this.LabelTime.Name = "LabelTime"; this.LabelTime.Size = new System.Drawing.Size(54, 13); this.LabelTime.TabIndex = 11; @@ -298,7 +304,7 @@ namespace WindowsFormsApplication1 // LabelDef2 // this.LabelDef2.AutoSize = true; - this.LabelDef2.Location = new System.Drawing.Point(240, 91); + this.LabelDef2.Location = new System.Drawing.Point(240, 64); this.LabelDef2.Name = "LabelDef2"; this.LabelDef2.Size = new System.Drawing.Size(13, 13); this.LabelDef2.TabIndex = 10; @@ -307,7 +313,7 @@ namespace WindowsFormsApplication1 // LabelDef1 // this.LabelDef1.AutoSize = true; - this.LabelDef1.Location = new System.Drawing.Point(240, 62); + this.LabelDef1.Location = new System.Drawing.Point(240, 35); this.LabelDef1.Name = "LabelDef1"; this.LabelDef1.Size = new System.Drawing.Size(13, 13); this.LabelDef1.TabIndex = 9; @@ -316,7 +322,7 @@ namespace WindowsFormsApplication1 // LabelWalls // this.LabelWalls.AutoSize = true; - this.LabelWalls.Location = new System.Drawing.Point(19, 62); + this.LabelWalls.Location = new System.Drawing.Point(19, 35); this.LabelWalls.Name = "LabelWalls"; this.LabelWalls.Size = new System.Drawing.Size(107, 13); this.LabelWalls.TabIndex = 8; @@ -324,21 +330,21 @@ namespace WindowsFormsApplication1 // // TextBoxTime1 // - this.TextBoxTime1.Location = new System.Drawing.Point(132, 88); + this.TextBoxTime1.Location = new System.Drawing.Point(132, 61); this.TextBoxTime1.Name = "TextBoxTime1"; this.TextBoxTime1.Size = new System.Drawing.Size(100, 20); this.TextBoxTime1.TabIndex = 5; // // TextBoxTime2 // - this.TextBoxTime2.Location = new System.Drawing.Point(259, 88); + this.TextBoxTime2.Location = new System.Drawing.Point(259, 61); this.TextBoxTime2.Name = "TextBoxTime2"; this.TextBoxTime2.Size = new System.Drawing.Size(100, 20); this.TextBoxTime2.TabIndex = 4; // // TextBoxWall2 // - this.TextBoxWall2.Location = new System.Drawing.Point(259, 59); + this.TextBoxWall2.Location = new System.Drawing.Point(259, 32); this.TextBoxWall2.Name = "TextBoxWall2"; this.TextBoxWall2.Size = new System.Drawing.Size(100, 20); this.TextBoxWall2.TabIndex = 3; @@ -346,7 +352,7 @@ namespace WindowsFormsApplication1 // // TextBoxWall1 // - this.TextBoxWall1.Location = new System.Drawing.Point(132, 59); + this.TextBoxWall1.Location = new System.Drawing.Point(132, 32); this.TextBoxWall1.Name = "TextBoxWall1"; this.TextBoxWall1.Size = new System.Drawing.Size(100, 20); this.TextBoxWall1.TabIndex = 2; @@ -361,16 +367,17 @@ namespace WindowsFormsApplication1 "Диагонально", "Волнами", "Кругами"}); - this.ComboBoxMove.Location = new System.Drawing.Point(107, 12); + this.ComboBoxMove.Location = new System.Drawing.Point(111, 3); this.ComboBoxMove.Name = "ComboBoxMove"; this.ComboBoxMove.Size = new System.Drawing.Size(121, 21); this.ComboBoxMove.TabIndex = 1; this.ComboBoxMove.Text = "Прямо"; + this.ComboBoxMove.SelectedIndexChanged += new System.EventHandler(this.ComboBoxMove_SelectedIndexChanged); // // LabelMoveType // this.LabelMoveType.AutoSize = true; - this.LabelMoveType.Location = new System.Drawing.Point(19, 12); + this.LabelMoveType.Location = new System.Drawing.Point(23, 3); this.LabelMoveType.Name = "LabelMoveType"; this.LabelMoveType.Size = new System.Drawing.Size(82, 13); this.LabelMoveType.TabIndex = 0; @@ -402,6 +409,24 @@ namespace WindowsFormsApplication1 // this.openFileDialog1.FileName = "openFileDialog1"; // + // textBox1 + // + this.textBox1.Location = new System.Drawing.Point(85, 114); + this.textBox1.Name = "textBox1"; + this.textBox1.Size = new System.Drawing.Size(138, 20); + this.textBox1.TabIndex = 21; + this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(4, 114); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(81, 13); + this.label2.TabIndex = 20; + this.label2.Text = "Кол-во кругов:"; + this.label2.Click += new System.EventHandler(this.label2_Click); + // // MainForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -462,5 +487,7 @@ namespace WindowsFormsApplication1 private System.Windows.Forms.Label label1; private System.Windows.Forms.TextBox charNameBox; private System.Windows.Forms.Label charNameLabel; + private System.Windows.Forms.TextBox textBox1; + private System.Windows.Forms.Label label2; } } \ No newline at end of file diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs index 9cc6004..f9059e7 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/MainForm.cs @@ -121,6 +121,7 @@ namespace WindowsFormsApplication1 persons[nomerPersa].moveside = ComboBoxMove.Text; persons[nomerPersa].nomer = nomerPersa; persons[nomerPersa].charname = charNameBox.Text; + persons[nomerPersa].circles = textBox1.Text; persons[nomerPersa].l2.Text = charNameBox.Text; String[] coordinatyNachala = TextBoxWall1.Text.Split(new String[] { "," }, StringSplitOptions.None); @@ -165,6 +166,7 @@ namespace WindowsFormsApplication1 } persons[pNomer].charname = charNameBox.Text; + persons[pNomer].circles = textBox1.Text; persons[pNomer].l2.Text = charNameBox.Text; } @@ -344,6 +346,7 @@ namespace WindowsFormsApplication1 ComboBoxMove.Text = persons[nomer].moveside; pNomer = persons[nomer].nomer; charNameBox.Text = persons[nomer].charname; + textBox1.Text = persons[nomer].circles; if (!String.IsNullOrEmpty(persons[nomer].adress)) { @@ -399,7 +402,43 @@ namespace WindowsFormsApplication1 tView2.ShowAlways = true; tView2.AutoPopDelay = 2000; tView2.SetToolTip(TextBoxWall2, "x.y"); + + ComboBoxMove_SelectedIndexChanged(sender, e); + textBox1_TextChanged(sender, e); } + private void ComboBoxMove_SelectedIndexChanged(object sender, EventArgs e) + { + if (ComboBoxMove.Text == "Кругами") + { + textBox1.Visible = true; + label2.Visible = true; + } + else + { + textBox1.Visible = false; + label2.Visible = false; + } + } + + private void panel3_Paint(object sender, PaintEventArgs e) + { + + } + + private void charNameBox_TextChanged(object sender, EventArgs e) + { + + } + + private void textBox1_TextChanged(object sender, EventArgs e) + { + + } + + private void label2_Click(object sender, EventArgs e) + { + + } } } \ No newline at end of file diff --git a/WindowsFormsApplication1/WindowsFormsApplication1/Person.cs b/WindowsFormsApplication1/WindowsFormsApplication1/Person.cs index 946eb7a..b646672 100644 --- a/WindowsFormsApplication1/WindowsFormsApplication1/Person.cs +++ b/WindowsFormsApplication1/WindowsFormsApplication1/Person.cs @@ -31,6 +31,7 @@ namespace WindowsFormsApplication1 public String charname; public String height; public String width; + public String circles; public static string PersonName(int nomer) {