forward/back buttons working & initial "save"

This commit is contained in:
Tim Young 2017-09-18 07:47:58 -05:00
parent ee9f046562
commit 795a4c6ce7
2 changed files with 35 additions and 0 deletions

View File

@ -171,6 +171,7 @@
this.btnApply.TabIndex = 10;
this.btnApply.Text = "Apply";
this.btnApply.UseVisualStyleBackColor = true;
this.btnApply.Click += new System.EventHandler(this.btnApply_Click);
//
// btnNewSprite
//
@ -222,6 +223,7 @@
this.btnBack.TabIndex = 16;
this.btnBack.Text = "<";
this.btnBack.UseVisualStyleBackColor = true;
this.btnBack.Click += new System.EventHandler(this.btnBack_Click);
//
// btnFwd
//
@ -232,6 +234,7 @@
this.btnFwd.TabIndex = 17;
this.btnFwd.Text = ">";
this.btnFwd.UseVisualStyleBackColor = true;
this.btnFwd.Click += new System.EventHandler(this.btnFwd_Click);
//
// lblCountSprites
//

View File

@ -280,5 +280,37 @@ namespace SpriteLibrary
WeAreDragging = false;
}
private void btnApply_Click(object sender, EventArgs e)
{
if(CurrentSIIndex >0 && CurrentSIIndex < SpriteInformation.Count)
{
SpriteInformation[CurrentSIIndex].CopyFrom(TempInformation);
}
else
{
SpriteInformation.Add(TempInformation);
CurrentSIIndex = SpriteInformation.IndexOf(TempInformation);
}
UpdateMenu();
}
private void btnFwd_Click(object sender, EventArgs e)
{
if (SpriteInformation.Count == 0) return; //nothing to do
CurrentSIIndex++;
if (CurrentSIIndex >= SpriteInformation.Count) CurrentSIIndex = 0;
SpriteInformationToForm();
UpdateMenu();
}
private void btnBack_Click(object sender, EventArgs e)
{
if (SpriteInformation.Count == 0) return; //nothing to do
CurrentSIIndex--;
if (CurrentSIIndex < 0) CurrentSIIndex = SpriteInformation.Count - 1;
SpriteInformationToForm();
UpdateMenu();
}
}
}