EDN Admin
Well-known member
This is the code of the button10 click event wich is the PLAY button:
<pre class="prettyprint private void button10_Click(object sender, EventArgs e)
{
_indx = 0;
files = new List<string>();
myTrackPanelss1.trackBar1.Value = 0;
string t = "";
for (int i = 0; i < lightningsRegions.Count; i++)
{
if (Lightnings_Extractor.Lightnings_Mode.item == lightningsRegions)
{
t = lightningsRegions;
}
}
int[] result = new int[2];
result = RetrieveStartEnd(t);
string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
files.Add(filename);
}
button10.ForeColor = Color.Red;
button9.ForeColor = Color.Black;
button4.ForeColor = Color.Black;
timer5.Start();
button9.Enabled = true;
button9.Text = "Pause";
button4.Enabled = true;
}[/code]
And this is the timer5 Tick event code:
<pre class="prettyprint private void button10_Click(object sender, EventArgs e)
{
_indx = 0;
files = new List<string>();
myTrackPanelss1.trackBar1.Value = 0;
string t = "";
for (int i = 0; i < lightningsRegions.Count; i++)
{
if (Lightnings_Extractor.Lightnings_Mode.item == lightningsRegions)
{
t = lightningsRegions;
}
}
int[] result = new int[2];
result = RetrieveStartEnd(t);
string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
files.Add(filename);
}
button10.ForeColor = Color.Red;
button9.ForeColor = Color.Black;
button4.ForeColor = Color.Black;
timer5.Start();
button9.Enabled = true;
button9.Text = "Pause";
button4.Enabled = true;
}[/code]
Now in the button10 click event the List files contain 10 files in this example the first file name in the list is: 000151.bmp the 000152.bmp and so on.
Now in the timer5 tick event in this line im getting the error:
<pre class="prettyprint Image img = Image.FromFile(files[_indx]);[/code]
And im sure this files are on my hard disk.
File Not Found 000151.bmp
<pre class="prettyprint System.IO.FileNotFoundException was caught
Message=000151.bmp
Source=System.Drawing
StackTrace:
at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at Extracting_Frames.Form1.timer5_Tick(Object sender, EventArgs e) in D:C-SharpExtracting_FramesExtracting_FramesExtracting_FramesForm1.cs:line 3051
InnerException: [/code]
<br/>
<
Maybe i need to use somheo FileInfo[] ? But not sure how.
<br/>
View the full article
<pre class="prettyprint private void button10_Click(object sender, EventArgs e)
{
_indx = 0;
files = new List<string>();
myTrackPanelss1.trackBar1.Value = 0;
string t = "";
for (int i = 0; i < lightningsRegions.Count; i++)
{
if (Lightnings_Extractor.Lightnings_Mode.item == lightningsRegions)
{
t = lightningsRegions;
}
}
int[] result = new int[2];
result = RetrieveStartEnd(t);
string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
files.Add(filename);
}
button10.ForeColor = Color.Red;
button9.ForeColor = Color.Black;
button4.ForeColor = Color.Black;
timer5.Start();
button9.Enabled = true;
button9.Text = "Pause";
button4.Enabled = true;
}[/code]
And this is the timer5 Tick event code:
<pre class="prettyprint private void button10_Click(object sender, EventArgs e)
{
_indx = 0;
files = new List<string>();
myTrackPanelss1.trackBar1.Value = 0;
string t = "";
for (int i = 0; i < lightningsRegions.Count; i++)
{
if (Lightnings_Extractor.Lightnings_Mode.item == lightningsRegions)
{
t = lightningsRegions;
}
}
int[] result = new int[2];
result = RetrieveStartEnd(t);
string filename;
int y;
for (y = 0; y <= (result[1] - result[0]); y++)
{
filename = null;
for (int x = 0; x < 6 - (result[0] + y).ToString().Length; x++)
{
filename += "0";
}
filename += result[0] + y + ".bmp";
files.Add(filename);
}
button10.ForeColor = Color.Red;
button9.ForeColor = Color.Black;
button4.ForeColor = Color.Black;
timer5.Start();
button9.Enabled = true;
button9.Text = "Pause";
button4.Enabled = true;
}[/code]
Now in the button10 click event the List files contain 10 files in this example the first file name in the list is: 000151.bmp the 000152.bmp and so on.
Now in the timer5 tick event in this line im getting the error:
<pre class="prettyprint Image img = Image.FromFile(files[_indx]);[/code]
And im sure this files are on my hard disk.
File Not Found 000151.bmp
<pre class="prettyprint System.IO.FileNotFoundException was caught
Message=000151.bmp
Source=System.Drawing
StackTrace:
at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
at System.Drawing.Image.FromFile(String filename)
at Extracting_Frames.Form1.timer5_Tick(Object sender, EventArgs e) in D:C-SharpExtracting_FramesExtracting_FramesExtracting_FramesForm1.cs:line 3051
InnerException: [/code]
<br/>
<
Maybe i need to use somheo FileInfo[] ? But not sure how.
<br/>
View the full article