コード例 #1
0
        private void insertToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tileList1.SelectedIndex == -1)
            {
                return;
            }
            OpenFileDialog a = new OpenFileDialog()
            {
                DefaultExt       = "png",
                Filter           = "Image Files|*.bmp;*.png;*.jpg;*.gif",
                Multiselect      = true,
                RestoreDirectory = true
            };

            if (a.ShowDialog() == DialogResult.OK)
            {
                int i = tileList1.SelectedIndex;
                foreach (string item in a.FileNames)
                {
                    sprites[curpal].Insert(i++, BitmapBits.FromBitmap(new Bitmap(a.FileName)));
                }
                tileList1.SelectedIndex = i;
                tileList1.ChangeSize();
            }
        }
コード例 #2
0
        private void replaceToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (tileList1.SelectedIndex == -1)
            {
                return;
            }
            OpenFileDialog a = new OpenFileDialog()
            {
                DefaultExt       = "png",
                Filter           = "Image Files|*.bmp;*.png;*.jpg;*.gif",
                FileName         = tileList1.SelectedIndex + ".png",
                RestoreDirectory = true
            };

            if (a.ShowDialog() == DialogResult.OK)
            {
                sprites[curpal][tileList1.SelectedIndex] = BitmapBits.FromBitmap(new Bitmap(a.FileName));
                tileList1.Invalidate();
                SpritePicture.Invalidate();
            }
        }