Добавил сохранение и редактирование

This commit is contained in:
Voltronormu 2018-04-10 17:07:46 +04:00 committed by GitHub
parent 50fad066df
commit b77b65efce
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,12 +23,17 @@ namespace WindowsFormsApplication1
public String coord; public String coord;
public String coord2; public String coord2;
public String adress; public String adress;
public String time1;
public String time2;
public String sprite;
public String moveside;
}; };
Person[] persons = new Person[200]; Person[] persons = new Person[200];
int yPersa = 300; int yPersa = 300;
int nomerPersa = 0; int nomerPersa = 0;
int pNomer = 0;
PictureBox[] pic1 = new PictureBox[1000]; PictureBox[] pic1 = new PictureBox[1000];
@ -43,6 +48,7 @@ namespace WindowsFormsApplication1
private void buttonAddCharClick(object sender, EventArgs e) private void buttonAddCharClick(object sender, EventArgs e)
{ {
panel3.Visible = true; panel3.Visible = true;
pNomer = -120;
} }
private string PersonName(int nomer) private string PersonName(int nomer)
@ -94,6 +100,9 @@ namespace WindowsFormsApplication1
private void SaveCharButtonClick(object sender, EventArgs e) private void SaveCharButtonClick(object sender, EventArgs e)
{ {
if (pNomer == -120)
{
persons[nomerPersa].l1 = new Label(); persons[nomerPersa].l1 = new Label();
persons[nomerPersa].l1.Top = yPersa; persons[nomerPersa].l1.Top = yPersa;
persons[nomerPersa].l1.Left = 30; persons[nomerPersa].l1.Left = 30;
@ -138,12 +147,29 @@ namespace WindowsFormsApplication1
persons[nomerPersa].coord = TextBoxWall1.Text; persons[nomerPersa].coord = TextBoxWall1.Text;
persons[nomerPersa].coord2 = TextBoxWall2.Text; persons[nomerPersa].coord2 = TextBoxWall2.Text;
persons[nomerPersa].time1 = TextBoxTime1.Text;
persons[nomerPersa].time2 = TextBoxTime2.Text;
persons[nomerPersa].sprite = SpriteNumberTextBox.Text;
persons[nomerPersa].moveside = ComboBoxMove.Text;
persons[nomerPersa].nomer = nomerPersa; persons[nomerPersa].nomer = nomerPersa;
nomerPersa++; nomerPersa++;
yPersa = yPersa + 30; yPersa = yPersa + 30;
openSpace.Image = null; openSpace.Image = null;
} }
else
{
persons[pNomer].coord = TextBoxWall1.Text;
persons[pNomer].coord2 = TextBoxWall2.Text;
persons[pNomer].time1 = TextBoxTime1.Text;
persons[pNomer].time2 = TextBoxTime2.Text;
persons[pNomer].sprite = SpriteNumberTextBox.Text;
persons[pNomer].moveside = ComboBoxMove.Text;
persons[pNomer].nomer = pNomer;
}
}
private void circle_create_person(string filename, string name) private void circle_create_person(string filename, string name)
{ {
@ -205,8 +231,15 @@ namespace WindowsFormsApplication1
if (openFileDialog1.ShowDialog() == DialogResult.Cancel) if (openFileDialog1.ShowDialog() == DialogResult.Cancel)
return; return;
openSpace.Image = Image.FromFile(openFileDialog1.FileName); openSpace.Image = Image.FromFile(openFileDialog1.FileName);
if (pNomer == -120)
{
persons[nomerPersa].adress = openFileDialog1.FileName; persons[nomerPersa].adress = openFileDialog1.FileName;
} }
else
{
persons[pNomer].adress = openFileDialog1.FileName;
}
}
private void AddBackArtClick(object sender, EventArgs e) private void AddBackArtClick(object sender, EventArgs e)
{ {
@ -283,6 +316,11 @@ namespace WindowsFormsApplication1
{ {
TextBoxWall1.Text = persons[nomer].coord; TextBoxWall1.Text = persons[nomer].coord;
TextBoxWall2.Text = persons[nomer].coord2; TextBoxWall2.Text = persons[nomer].coord2;
TextBoxTime1.Text = persons[nomer].time1;
TextBoxTime2.Text = persons[nomer].time2;
SpriteNumberTextBox.Text = persons[nomer].sprite;
ComboBoxMove.Text = persons[nomer].moveside;
pNomer = persons[nomer].nomer;
if (!String.IsNullOrEmpty(persons[nomer].adress)) if (!String.IsNullOrEmpty(persons[nomer].adress))
{ {