private void CheckKeys(object sender, System.Windows.Forms.KeyPressEventArgs e)
 {
     if (e.KeyChar == (char)13)
     {
         CAnimation tempanim = new CAnimation();
         tempanim.AnimLooping = false;
         tempanim.AnimType = 0;
         tempanim.CurrFrame = 0;
         tempanim.ElapsedTime = 0.0f;
         CFrame tempframe = new CFrame();
         tempframe.FrameNum = 0;
         Rectangle temprect = new Rectangle();
         temprect.X = 0;
         temprect.Y = 0;
         temprect.Width = 0;
         temprect.Height = 0;
         tempframe.Rect = temprect;
         tempframe.TimePlayed = 0.0f;
         tempframe.AnchorPointX = 0;
         tempframe.AnchorPointY = 0;
         tempanim.FrameVec.Add(tempframe);
         tempanim.ImagePath = "";
         tempanim.UnitType = 0;
         tempanim.NameOfAnim = animname.Text;
         animations.Add(tempanim);
         animlist.Items.Add(tempanim.NameOfAnim);
     }
 }
 private void loadToolStripMenuItem_Click(object sender, EventArgs e)
 {
     OpenFileDialog OpenThis = new OpenFileDialog();
     OpenThis.Filter = "XML Files|*xml";
     OpenThis.InitialDirectory = folderpath;
     if (DialogResult.OK == OpenThis.ShowDialog())
     {
         XElement pRoot = XElement.Load(OpenThis.FileName);
         IEnumerable<XElement> xAnimations = pRoot.Elements();
         foreach (XElement Animation in xAnimations)
         {
             CAnimation tempanim = new CAnimation();
             tempanim.UnitType = (int)Animation.Attribute("UnitType");
             tempanim.AnimType = (int)Animation.Attribute("AnimType");
             tempanim.AnimLooping = (bool)Animation.Attribute("IsLooping");
             tempanim.ImagePath = (string)Animation.Attribute("ImgName");
             tempanim.CurrFrame = (int)Animation.Attribute("CurrentFrame");
             tempanim.NameOfAnim = (string)Animation.Attribute("AnimationName");
             IEnumerable<XElement> xFrames = Animation.Elements();
             foreach (XElement Frame in xFrames)
             {
                 CFrame tempframe = new CFrame();
                 tempframe.FrameNum = (int)Frame.Attribute("FrameNumber");
                 tempframe.TimePlayed = (int)Frame.Attribute("TimeForFrameToRun");
                 Rectangle temprect = new Rectangle();
                 temprect.Y = (int)Frame.Attribute("top");
                 temprect.X = (int)Frame.Attribute("left");
                 temprect.Width = (int)Frame.Attribute("right") - temprect.X;
                 temprect.Height = (int)Frame.Attribute("bottom") - temprect.Y;
                 tempframe.Rect = temprect;
                 tempframe.AnchorPointX = (int)Frame.Attribute("AnchorX");
                 tempframe.AnchorPointY = (int)Frame.Attribute("AnchorY");
                 tempanim.FrameVec.Add(tempframe);
             }
             Animations.Add(tempanim);
             animlist.Items.Add(tempanim.NameOfAnim);
         }
     }
 }
 private void AddFrameButton_Click(object sender, EventArgs e)
 {
     CFrame tempframe = new CFrame();
     tempframe.FrameNum = 0;
     Rectangle temprect = new Rectangle();
     temprect.X = 0;
     temprect.Y = 0;
     temprect.Width = 0;
     temprect.Height = 0;
     tempframe.Rect = temprect;
     tempframe.TimePlayed = 0.0f;
     tempframe.AnchorPointX = 0;
     tempframe.AnchorPointY = 0;
     if (animations.Capacity >= 0 && animlist.SelectedIndex >= 0)
     {
         animations[animlist.SelectedIndex].FrameVec.Add(tempframe);
         numofframesinanim.Maximum++;
     }
 }