private void pictureBox1_Click(object sender, EventArgs e) { bool isaGif = false; if (Path.GetExtension(desta) == ".gif") { isaGif = true; } GifDialog a = new GifDialog(desta, isaGif); a.StartPosition = FormStartPosition.CenterParent; a.MaximumSize = new Size(300, 300); try { if (a.ShowDialog() == DialogResult.OK) { a.Dispose(); } } catch (Exception) { a.Dispose(); // logger.writeConsoleError("Gif animation error", ex); MessageBox.Show("Gif closed due to GDI+ error in playback \n Gif may be corrupt"); } }
// Handler for clicking on the main picture box. For animating GIFs and showing images in original dimensions private void pictureBox1_Click(object sender, EventArgs e) { string focusImagePath = GetFilePath(); if (focusImagePath == "NULL") { MessageBox.Show("Not a valid image"); } else { bool isaGif = false; if (Path.GetExtension(focusImagePath) == ".gif") { isaGif = true; } GifDialog gifDialog = new GifDialog(focusImagePath, isaGif); gifDialog.StartPosition = FormStartPosition.CenterParent; gifDialog.MaximumSize = new Size(deskWidth - 40, deskHeight - 40); try { if (gifDialog.ShowDialog() == DialogResult.OK) { gifDialog.Dispose(); } } catch (Exception ex) { gifDialog.Dispose(); logger.writeConsoleError("Gif animation error", ex); MessageBox.Show("'.GIF' closed due to GDI+ error in playback"); } } }