Click here to Skip to main content
15,886,873 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
string pathToImage = @"test1.gif";
pathToImage = AppDomain.CurrentDomain.BaseDirectory + pathToImage;

 //Try extracting the frames
 frames = EnumerateFrames(pathToImage);
 if (frames == null || frames.Count() == 0) {
     MessageBox.Show("Unable to obtain frames from " + pathToImage);
 }

 for (int i = 0; i < frames.Count(); i++)
 {
     ListBox1.Items.Add("Frame-" + i.ToString());
 }



What I have tried:

OpenFileDialog dlg = new OpenFileDialog();

                dlg.Title = "Open Image";
                dlg.Filter = "GIF files (*.gif)|*.gif";
                dlg.ShowDialog();

                if (dlg.ShowDialog() == DialogResult.OK)
                {
                    string pathToImage = dlg.FileName;

                }

                
                frames = EnumerateFrames(pathToImage);
                if (frames == null || frames.Count() == 0)
                {
                    MessageBox.Show("Unable to obtain frames from " + pathToImage);
                }

                for (int i = 0; i < frames.Count(); i++)
                {
                    ListBox1.Items.Add("Frame-" + i.ToString());
                }
Posted
Updated 11-Feb-19 1:35am
Comments
Richard MacCutchan 11-Feb-19 7:33am    
What is the problem?

1 solution

You have two calls to ShowDialog, delete the first one:
string pathToImage;
dlg.Title = "Open Image";
dlg.Filter = "GIF files (*.gif)|*.gif";

if (dlg.ShowDialog() == DialogResult.OK)
{
    pathToImage = dlg.FileName;

}
 
Share this answer
 
v2
Comments
Member 14129828 11-Feb-19 8:19am    
thank you very much

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900