public void AddSprite(CShadowSprite spr) { loadedSSPK.Sprites.Add(spr); lbSprites.Items.Add(spr.Name); lbSprites.SelectedItems.Clear(); }
private void MoveSpriteToIndex(int srcindex, int dstindex) { if (srcindex != -1 && dstindex != -1) { CShadowSprite spr = loadedSSPK.Sprites[srcindex]; loadedSSPK.Sprites.RemoveAt(srcindex); loadedSSPK.Sprites.Insert(dstindex, spr); lbSprites.Items.RemoveAt(srcindex); lbSprites.Items.Insert(dstindex, spr.Name); lbSprites.SelectedIndices.Add(dstindex); UpdateStatusLabel(); } }
private void tsmiEditImportImage_Click(object sender, EventArgs e) { openFileDialog.Filter = "PNG Files|*.png|TIFF Files|*.tiff|BMP Files|*.bmp"; openFileDialog.Multiselect = true; if (openFileDialog.ShowDialog() == DialogResult.OK) { if (openFileDialog.FileNames.Length == 1) { DirectoryInfo dir = new DirectoryInfo(openFileDialog.FileName); Image img = Image.FromFile(openFileDialog.FileName); CShadowSprite spr = new CShadowSprite(img); spr.Name = dir.Name; loadedSSPK.Sprites.Add(spr); lbSprites.Items.Add(spr.Name); } else { foreach (string fn in openFileDialog.FileNames) { DirectoryInfo dir = new DirectoryInfo(fn); Image img = Image.FromFile(fn); CShadowSprite spr = new CShadowSprite(img); spr.Name = dir.Name; loadedSSPK.Sprites.Add(spr); lbSprites.Items.Add(spr.Name); } } } openFileDialog.Multiselect = false; }