Пишем данные с формы

This commit is contained in:
Arsenee 2018-02-20 17:30:34 +04:00 committed by GitHub
parent e77b7607ff
commit 26ee94d853
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 123 additions and 134 deletions

View file

@ -1,6 +1,6 @@
namespace WindowsFormsApplication1
{
partial class Form1
partial class MainForm
{
/// <summary>
/// Требуется переменная конструктора.
@ -33,16 +33,14 @@
this.label3 = new System.Windows.Forms.Label();
this.nazvanieTextBox = new System.Windows.Forms.TextBox();
this.panel1 = new System.Windows.Forms.Panel();
this.comboBox1 = new System.Windows.Forms.ComboBox();
this.label6 = new System.Windows.Forms.Label();
this.label5 = new System.Windows.Forms.Label();
this.textBox3 = new System.Windows.Forms.TextBox();
this.textBox2 = new System.Windows.Forms.TextBox();
this.label4 = new System.Windows.Forms.Label();
this.label14 = new System.Windows.Forms.Label();
this.dobavitFonButton = new System.Windows.Forms.Button();
this.splitter1 = new System.Windows.Forms.Splitter();
this.panel2 = new System.Windows.Forms.Panel();
this.button3 = new System.Windows.Forms.Button();
this.panel3 = new System.Windows.Forms.Panel();
this.spriteLabel = new System.Windows.Forms.Label();
this.spriteTextBox = new System.Windows.Forms.TextBox();
this.button5 = new System.Windows.Forms.Button();
this.button4 = new System.Windows.Forms.Button();
this.label12 = new System.Windows.Forms.Label();
@ -50,7 +48,6 @@
this.label10 = new System.Windows.Forms.Label();
this.label9 = new System.Windows.Forms.Label();
this.label8 = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.textBox7 = new System.Windows.Forms.TextBox();
this.textBox6 = new System.Windows.Forms.TextBox();
this.textBox5 = new System.Windows.Forms.TextBox();
@ -61,7 +58,7 @@
this.button1 = new System.Windows.Forms.Button();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.button6 = new System.Windows.Forms.Button();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.panel1.SuspendLayout();
this.panel2.SuspendLayout();
this.panel3.SuspendLayout();
@ -72,11 +69,11 @@
//
this.label1.AutoSize = true;
this.label1.Font = new System.Drawing.Font("Arial Black", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.label1.Location = new System.Drawing.Point(12, 24);
this.label1.Location = new System.Drawing.Point(0, 9);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(172, 23);
this.label1.Size = new System.Drawing.Size(224, 23);
this.label1.TabIndex = 0;
this.label1.Text = "Данные о мульте:";
this.label1.Text = "Данные о мултфильме:";
this.label1.Click += new System.EventHandler(this.label1_Click);
//
// label2
@ -107,13 +104,9 @@
//
// panel1
//
this.panel1.Controls.Add(this.button6);
this.panel1.Controls.Add(this.comboBox1);
this.panel1.Controls.Add(this.label6);
this.panel1.Controls.Add(this.label5);
this.panel1.Controls.Add(this.textBox3);
this.panel1.Controls.Add(this.textBox2);
this.panel1.Controls.Add(this.label4);
this.panel1.Controls.Add(this.pictureBox1);
this.panel1.Controls.Add(this.label14);
this.panel1.Controls.Add(this.dobavitFonButton);
this.panel1.Controls.Add(this.label1);
this.panel1.Controls.Add(this.nazvanieTextBox);
this.panel1.Controls.Add(this.label2);
@ -121,73 +114,33 @@
this.panel1.Dock = System.Windows.Forms.DockStyle.Left;
this.panel1.Location = new System.Drawing.Point(0, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(227, 273);
this.panel1.Size = new System.Drawing.Size(227, 296);
this.panel1.TabIndex = 4;
//
// comboBox1
// label14
//
this.comboBox1.ForeColor = System.Drawing.SystemColors.WindowText;
this.comboBox1.FormattingEnabled = true;
this.comboBox1.Items.AddRange(new object[] {
"4К",
"1080HD",
"720HD",
"480",
"360",
"240"});
this.comboBox1.Location = new System.Drawing.Point(77, 159);
this.comboBox1.Name = "comboBox1";
this.comboBox1.Size = new System.Drawing.Size(121, 21);
this.comboBox1.TabIndex = 9;
this.comboBox1.Text = "Авто";
this.label14.AutoSize = true;
this.label14.Location = new System.Drawing.Point(14, 114);
this.label14.Name = "label14";
this.label14.Size = new System.Drawing.Size(77, 13);
this.label14.TabIndex = 11;
this.label14.Text = "Выбрать фон:";
//
// label6
// dobavitFonButton
//
this.label6.AutoSize = true;
this.label6.Location = new System.Drawing.Point(14, 159);
this.label6.Name = "label6";
this.label6.Size = new System.Drawing.Size(57, 13);
this.label6.TabIndex = 8;
this.label6.Text = "Качество:";
//
// label5
//
this.label5.AutoSize = true;
this.label5.Location = new System.Drawing.Point(156, 128);
this.label5.Name = "label5";
this.label5.Size = new System.Drawing.Size(11, 13);
this.label5.TabIndex = 7;
this.label5.Text = "*";
//
// textBox3
//
this.textBox3.Location = new System.Drawing.Point(173, 121);
this.textBox3.Name = "textBox3";
this.textBox3.Size = new System.Drawing.Size(45, 20);
this.textBox3.TabIndex = 6;
this.textBox3.TextChanged += new System.EventHandler(this.textBox3_TextChanged);
//
// textBox2
//
this.textBox2.Location = new System.Drawing.Point(105, 121);
this.textBox2.Name = "textBox2";
this.textBox2.Size = new System.Drawing.Size(45, 20);
this.textBox2.TabIndex = 5;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(14, 121);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(84, 13);
this.label4.TabIndex = 4;
this.label4.Text = "Размеры окна:";
this.dobavitFonButton.Location = new System.Drawing.Point(17, 130);
this.dobavitFonButton.Name = "dobavitFonButton";
this.dobavitFonButton.Size = new System.Drawing.Size(116, 24);
this.dobavitFonButton.TabIndex = 10;
this.dobavitFonButton.Text = "Добавить";
this.dobavitFonButton.UseVisualStyleBackColor = true;
this.dobavitFonButton.Click += new System.EventHandler(this.button6_Click);
//
// splitter1
//
this.splitter1.Location = new System.Drawing.Point(227, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(3, 273);
this.splitter1.Size = new System.Drawing.Size(3, 296);
this.splitter1.TabIndex = 5;
this.splitter1.TabStop = false;
//
@ -200,13 +153,13 @@
this.panel2.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel2.Location = new System.Drawing.Point(230, 0);
this.panel2.Name = "panel2";
this.panel2.Size = new System.Drawing.Size(408, 273);
this.panel2.Size = new System.Drawing.Size(408, 296);
this.panel2.TabIndex = 6;
//
// button3
//
this.button3.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button3.Location = new System.Drawing.Point(0, 213);
this.button3.Location = new System.Drawing.Point(0, 236);
this.button3.Name = "button3";
this.button3.Size = new System.Drawing.Size(408, 30);
this.button3.TabIndex = 3;
@ -216,6 +169,8 @@
//
// panel3
//
this.panel3.Controls.Add(this.spriteLabel);
this.panel3.Controls.Add(this.spriteTextBox);
this.panel3.Controls.Add(this.button5);
this.panel3.Controls.Add(this.button4);
this.panel3.Controls.Add(this.label12);
@ -223,7 +178,6 @@
this.panel3.Controls.Add(this.label10);
this.panel3.Controls.Add(this.label9);
this.panel3.Controls.Add(this.label8);
this.panel3.Controls.Add(this.pictureBox1);
this.panel3.Controls.Add(this.textBox7);
this.panel3.Controls.Add(this.textBox6);
this.panel3.Controls.Add(this.textBox5);
@ -233,13 +187,30 @@
this.panel3.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel3.Location = new System.Drawing.Point(0, 26);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(408, 217);
this.panel3.Size = new System.Drawing.Size(408, 240);
this.panel3.TabIndex = 2;
this.panel3.Visible = false;
//
// spriteLabel
//
this.spriteLabel.AutoSize = true;
this.spriteLabel.Location = new System.Drawing.Point(7, 153);
this.spriteLabel.Name = "spriteLabel";
this.spriteLabel.Size = new System.Drawing.Size(119, 13);
this.spriteLabel.TabIndex = 16;
this.spriteLabel.Text = "Количество спрайтов:";
this.spriteLabel.Click += new System.EventHandler(this.label13_Click_1);
//
// spriteTextBox
//
this.spriteTextBox.Location = new System.Drawing.Point(10, 169);
this.spriteTextBox.Name = "spriteTextBox";
this.spriteTextBox.Size = new System.Drawing.Size(83, 20);
this.spriteTextBox.TabIndex = 15;
//
// button5
//
this.button5.Location = new System.Drawing.Point(234, 158);
this.button5.Location = new System.Drawing.Point(221, 160);
this.button5.Name = "button5";
this.button5.Size = new System.Drawing.Size(171, 30);
this.button5.TabIndex = 14;
@ -249,7 +220,7 @@
//
// button4
//
this.button4.Location = new System.Drawing.Point(19, 134);
this.button4.Location = new System.Drawing.Point(132, 169);
this.button4.Name = "button4";
this.button4.Size = new System.Drawing.Size(65, 20);
this.button4.TabIndex = 13;
@ -260,7 +231,7 @@
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(19, 117);
this.label12.Location = new System.Drawing.Point(129, 153);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(58, 13);
this.label12.TabIndex = 12;
@ -269,7 +240,7 @@
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(19, 79);
this.label11.Location = new System.Drawing.Point(19, 91);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(54, 13);
this.label11.TabIndex = 11;
@ -278,7 +249,7 @@
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(240, 79);
this.label10.Location = new System.Drawing.Point(240, 91);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(13, 13);
this.label10.TabIndex = 10;
@ -288,7 +259,7 @@
// label9
//
this.label9.AutoSize = true;
this.label9.Location = new System.Drawing.Point(240, 50);
this.label9.Location = new System.Drawing.Point(240, 62);
this.label9.Name = "label9";
this.label9.Size = new System.Drawing.Size(13, 13);
this.label9.TabIndex = 9;
@ -298,46 +269,38 @@
// label8
//
this.label8.AutoSize = true;
this.label8.Location = new System.Drawing.Point(19, 50);
this.label8.Location = new System.Drawing.Point(19, 62);
this.label8.Name = "label8";
this.label8.Size = new System.Drawing.Size(107, 13);
this.label8.TabIndex = 8;
this.label8.Text = "Границы движения:";
//
// pictureBox1
//
this.pictureBox1.Location = new System.Drawing.Point(90, 117);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(103, 64);
this.pictureBox1.SizeMode = System.Windows.Forms.PictureBoxSizeMode.AutoSize;
this.pictureBox1.TabIndex = 6;
this.pictureBox1.TabStop = false;
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
this.label8.Click += new System.EventHandler(this.label8_Click);
//
// textBox7
//
this.textBox7.Location = new System.Drawing.Point(132, 76);
this.textBox7.Location = new System.Drawing.Point(132, 88);
this.textBox7.Name = "textBox7";
this.textBox7.Size = new System.Drawing.Size(100, 20);
this.textBox7.TabIndex = 5;
//
// textBox6
//
this.textBox6.Location = new System.Drawing.Point(259, 76);
this.textBox6.Location = new System.Drawing.Point(259, 88);
this.textBox6.Name = "textBox6";
this.textBox6.Size = new System.Drawing.Size(100, 20);
this.textBox6.TabIndex = 4;
this.textBox6.TextChanged += new System.EventHandler(this.textBox6_TextChanged);
//
// textBox5
//
this.textBox5.Location = new System.Drawing.Point(259, 47);
this.textBox5.Location = new System.Drawing.Point(259, 59);
this.textBox5.Name = "textBox5";
this.textBox5.Size = new System.Drawing.Size(100, 20);
this.textBox5.TabIndex = 3;
//
// textBox4
//
this.textBox4.Location = new System.Drawing.Point(132, 47);
this.textBox4.Location = new System.Drawing.Point(132, 59);
this.textBox4.Name = "textBox4";
this.textBox4.Size = new System.Drawing.Size(100, 20);
this.textBox4.TabIndex = 2;
@ -350,7 +313,7 @@
"По диагонали",
"Волнами",
"Кругами"});
this.comboBox2.Location = new System.Drawing.Point(104, 8);
this.comboBox2.Location = new System.Drawing.Point(107, 12);
this.comboBox2.Name = "comboBox2";
this.comboBox2.Size = new System.Drawing.Size(121, 21);
this.comboBox2.TabIndex = 1;
@ -359,7 +322,7 @@
// label7
//
this.label7.AutoSize = true;
this.label7.Location = new System.Drawing.Point(16, 8);
this.label7.Location = new System.Drawing.Point(19, 12);
this.label7.Name = "label7";
this.label7.Size = new System.Drawing.Size(82, 13);
this.label7.TabIndex = 0;
@ -368,7 +331,7 @@
// button2
//
this.button2.Dock = System.Windows.Forms.DockStyle.Bottom;
this.button2.Location = new System.Drawing.Point(0, 243);
this.button2.Location = new System.Drawing.Point(0, 266);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(408, 30);
this.button2.TabIndex = 1;
@ -390,26 +353,25 @@
//
this.openFileDialog1.FileName = "openFileDialog1";
//
// button6
// pictureBox1
//
this.button6.Location = new System.Drawing.Point(105, 213);
this.button6.Name = "button6";
this.button6.Size = new System.Drawing.Size(75, 23);
this.button6.TabIndex = 10;
this.button6.Text = "button6";
this.button6.UseVisualStyleBackColor = true;
this.button6.Click += new System.EventHandler(this.button6_Click);
this.pictureBox1.Location = new System.Drawing.Point(17, 160);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(100, 50);
this.pictureBox1.TabIndex = 12;
this.pictureBox1.TabStop = false;
//
// Form1
// MainForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(638, 273);
this.ClientSize = new System.Drawing.Size(638, 296);
this.Controls.Add(this.panel2);
this.Controls.Add(this.splitter1);
this.Controls.Add(this.panel1);
this.Name = "Form1";
this.Text = "Form1";
this.Name = "MainForm";
this.RightToLeftLayout = true;
this.Text = "Свойства персонажа";
this.Load += new System.EventHandler(this.Form1_Load);
this.panel1.ResumeLayout(false);
this.panel1.PerformLayout();
@ -428,19 +390,12 @@
private System.Windows.Forms.Label label3;
private System.Windows.Forms.TextBox nazvanieTextBox;
private System.Windows.Forms.Panel panel1;
private System.Windows.Forms.Label label5;
private System.Windows.Forms.TextBox textBox3;
private System.Windows.Forms.TextBox textBox2;
private System.Windows.Forms.Label label4;
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.Panel panel2;
private System.Windows.Forms.ComboBox comboBox1;
private System.Windows.Forms.Label label6;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label7;
private System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.TextBox textBox7;
private System.Windows.Forms.TextBox textBox6;
private System.Windows.Forms.TextBox textBox5;
@ -456,7 +411,11 @@
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.Button button5;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.Button button6;
private System.Windows.Forms.Label spriteLabel;
private System.Windows.Forms.TextBox spriteTextBox;
private System.Windows.Forms.Label label14;
private System.Windows.Forms.Button dobavitFonButton;
private System.Windows.Forms.PictureBox pictureBox1;
}
}

View file

@ -15,12 +15,12 @@ namespace WindowsFormsApplication1
public string nazvanie_personazha;
}
public partial class Form1 : Form
public partial class MainForm : Form
{
PictureBox[] pic1 = new PictureBox[1000];
public Form1()
public MainForm()
{
InitializeComponent();
@ -80,7 +80,7 @@ namespace WindowsFormsApplication1
//Создаешь из них массив (или список)
//Выбираешь рандомный номер
pictureBox1.Image = Image.FromFile("kartinka.jpg");
//pictureBox1.Image = Image.FromFile("kartinka.jpg");
}
private void pictureBox1_Click(object sender, EventArgs e)
@ -98,7 +98,7 @@ namespace WindowsFormsApplication1
System.IO.File.AppendAllText(filename, Environment.NewLine);
System.IO.File.AppendAllText(filename, "int main()" + Environment.NewLine);
System.IO.File.AppendAllText(filename, "{" + Environment.NewLine);
txCreateWindow(800, 600);
//txCreateWindow(800, 600);
@ -110,7 +110,7 @@ namespace WindowsFormsApplication1
//тут будет мультфильм
System.IO.File.AppendAllText(filename, "return 0;" + Environment.NewLine);
System.IO.File.AppendAllText(filename, "return " + spriteTextBox.Text + "0;" + Environment.NewLine);
System.IO.File.AppendAllText(filename, "}" + Environment.NewLine);
MessageBox.Show("Файл сохранен");
@ -126,9 +126,36 @@ namespace WindowsFormsApplication1
MessageBox.Show("Файл открыт");
}
private void textBox6_TextChanged(object sender, EventArgs e)
{
}
private void label8_Click(object sender, EventArgs e)
{
}
private void label13_Click(object sender, EventArgs e)
{
}
private void label13_Click_1(object sender, EventArgs e)
{
}
private void button6_Click(object sender, EventArgs e)
{
Close();
}
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return;
string filename = openFileDialog1.FileName;
string fileText = System.IO.File.ReadAllText(filename);
nazvanieTextBox.Text = fileText;
//MessageBox.Show("Файл открыт");
pictureBox1.Image = Image.FromFile("kartinka.jpg");
}
}
}

View file

@ -123,4 +123,7 @@
<metadata name="openFileDialog1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>153, 17</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>39</value>
</metadata>
</root>

View file

@ -15,7 +15,7 @@ namespace WindowsFormsApplication1
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
Application.Run(new MainForm());
}
}
}