private void GifWrapperFrm_DragDrop(object sender, DragEventArgs e) { if (e.Data.GetDataPresent(DataFormats.FileDrop)) { try { string[] files = (string[])e.Data.GetData(DataFormats.FileDrop); if (files != null && files.Length > 0) { GifWrapper gif = new GifWrapper(files[0]); Wrapper = gif; _filename = files[0]; } } catch (Exception ex) { MessageBox.Show("Error loading the GIF image:\r\n\r\n" + ex.Message, "Load error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void menuFileOpen_Click(object sender, EventArgs e) { OpenFileDialog d = new OpenFileDialog(); d.AutoUpgradeEnabled = true; d.Filter = "GIF Image|*.gif|All files|*.*"; d.FilterIndex = 0; d.Multiselect = false; d.RestoreDirectory = true; if (d.ShowDialog() == DialogResult.OK) { try { GifWrapper gif = new GifWrapper(d.FileName); Wrapper = gif; _filename = d.FileName; } catch (Exception ex) { MessageBox.Show("Error loading the GIF image:\r\n\r\n" + ex.Message, "Load error!", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }