예제 #1
0
 private void OnClickReplace(object sender, EventArgs e)
 {
     if (listView1.SelectedItems.Count > 0)
     {
         using (OpenFileDialog dialog = new OpenFileDialog())
         {
             int frameindex = (int)listView1.SelectedItems[0].Tag;
             dialog.Multiselect     = false;
             dialog.Title           = String.Format("Выбирите файлы изображений, которым хотите заменить {0}й кадр.", frameindex);
             dialog.CheckFileExists = true;
             dialog.Filter          = "файлы изображений (*.tiff;*.bmp)|*.tiff;*.bmp";
             if (dialog.ShowDialog() == DialogResult.OK)
             {
                 Bitmap bmp = new Bitmap(dialog.FileName);
                 if (dialog.FileName.Contains(".bmp"))
                 {
                     bmp = Utils.ConvertBmp(bmp);
                 }
                 AnimIdx edit = Ultima.AnimationEdit.GetAnimation(FileType, CurrBody, CurrAction, CurrDir);
                 if (edit != null)
                 {
                     edit.ReplaceFrame(bmp, frameindex);
                     listView1.Invalidate();
                     Options.ChangedUltimaClass["Animations"] = true;
                 }
             }
         }
     }
 }