Сохранение и очистка картинки

This commit is contained in:
Voltronormu 2018-04-06 16:38:17 +04:00 committed by GitHub
parent 0215aa3760
commit 0f9de440ad
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 36 additions and 35 deletions

View file

@ -59,10 +59,12 @@ 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();
this.panel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.openSpace)).BeginInit();
this.SuspendLayout();
//
// LabelData
@ -125,32 +127,6 @@ namespace WindowsFormsApplication1
this.label13.TabIndex = 23;
this.label13.Text = "ИНФОРМАЦИЯ О ПЕРСОНАЖАХ";
//
// label12
//
this.label12.AutoSize = true;
this.label12.Location = new System.Drawing.Point(143, 308);
this.label12.Name = "label12";
this.label12.Size = new System.Drawing.Size(39, 13);
this.label12.TabIndex = 22;
this.label12.Text = "номер";
//
// label11
//
this.label11.AutoSize = true;
this.label11.Location = new System.Drawing.Point(79, 308);
this.label11.Name = "label11";
this.label11.Size = new System.Drawing.Size(39, 13);
this.label11.TabIndex = 22;
this.label11.Text = "время";
//
// label10
//
this.label10.AutoSize = true;
this.label10.Location = new System.Drawing.Point(9, 308);
this.label10.Name = "label10";
this.label10.Size = new System.Drawing.Size(27, 13);
this.label10.TabIndex = 22;
this.label10.Text = "имя";
// PictureBoxBackground
//
this.PictureBoxBackground.Location = new System.Drawing.Point(17, 160);
@ -201,7 +177,7 @@ namespace WindowsFormsApplication1
// SaveCharButton
//
this.SaveCharButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.SaveCharButton.Location = new System.Drawing.Point(0, 315);
this.SaveCharButton.Location = new System.Drawing.Point(0, 320);
this.SaveCharButton.Name = "SaveCharButton";
this.SaveCharButton.Size = new System.Drawing.Size(377, 30);
this.SaveCharButton.TabIndex = 3;
@ -211,6 +187,7 @@ namespace WindowsFormsApplication1
//
// panel3
//
this.panel3.Controls.Add(this.openSpace);
this.panel3.Controls.Add(this.SpriteNumberLabel);
this.panel3.Controls.Add(this.SpriteNumberTextBox);
this.panel3.Controls.Add(this.OpenButton);
@ -228,7 +205,7 @@ namespace WindowsFormsApplication1
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(392, 319);
this.panel3.Size = new System.Drawing.Size(377, 324);
this.panel3.TabIndex = 2;
this.panel3.Visible = false;
//
@ -357,7 +334,7 @@ namespace WindowsFormsApplication1
// SaveMultButton
//
this.SaveMultButton.Dock = System.Windows.Forms.DockStyle.Bottom;
this.SaveMultButton.Location = new System.Drawing.Point(0, 345);
this.SaveMultButton.Location = new System.Drawing.Point(0, 350);
this.SaveMultButton.Name = "SaveMultButton";
this.SaveMultButton.Size = new System.Drawing.Size(377, 30);
this.SaveMultButton.TabIndex = 1;
@ -380,6 +357,14 @@ 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);
@ -397,6 +382,7 @@ namespace WindowsFormsApplication1
this.panel2.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.openSpace)).EndInit();
this.ResumeLayout(false);
}
@ -434,5 +420,6 @@ namespace WindowsFormsApplication1
private System.Windows.Forms.Button dobavitFonButton;
private System.Windows.Forms.PictureBox PictureBoxBackground;
private System.Windows.Forms.Label label13;
private System.Windows.Forms.PictureBox openSpace;
}
}

View file

@ -21,6 +21,7 @@ namespace WindowsFormsApplication1
public int nomer;
public String coord;
public String adress;
};
Person[] persons = new Person[200];
@ -139,6 +140,7 @@ namespace WindowsFormsApplication1
nomerPersa++;
yPersa = yPersa + 30;
openSpace.Image = null;
}
private void circle_create_person(string filename, string name)
@ -200,9 +202,8 @@ namespace WindowsFormsApplication1
{
if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return;
string filename = openFileDialog1.FileName;
string fileText =File.ReadAllText(filename);
nazvanieTextBox.Text = fileText;
openSpace.Image = Image.FromFile(openFileDialog1.FileName);
persons[nomerPersa].adress = openFileDialog1.FileName;
}
private void AddBackArtClick(object sender, EventArgs e)
@ -272,13 +273,21 @@ namespace WindowsFormsApplication1
if (sender.Equals(persons[nomer].b1))
{
TextBoxWall1.Text = persons[nomer].coord;
if (!String.IsNullOrEmpty(persons[nomer].adress))
{
openSpace.Image = Image.FromFile(persons[nomer].adress);
}
else
{
openSpace.Image = null;
}
}
}
}
private void SaveMultButton_Click(object sender, EventArgs e)
private void OpenSpace_Click(object sender, EventArgs e)
{
//надо
}
}
}

View file

@ -9,8 +9,9 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>WindowsFormsApplication1</RootNamespace>
<AssemblyName>WindowsFormsApplication1</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -21,6 +22,7 @@
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -30,6 +32,7 @@
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
@ -66,7 +69,9 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="app.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>