EDN Admin
Well-known member
I have this code in Form1:
<pre class="prettyprint private void toolStripComboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
Calculations();
lightningsRegions = new List<string>();
int lightnings = 0;
//*** Start of lightning ***\
string f = Path.GetDirectoryName(fileName);
DirectoryInfo dir = new DirectoryInfo(f);
_fi = dir.GetFiles("*.bmp");
for (int i = 35; i < averagesOriginal.Count - 70; i++)
{
if (averagesOriginal <= resultings[i - 35])
{
if (averagesOriginal[i + 1] > resultings[i - 35])
{
Lightnings_Extractor.Lightnings_Region.start = i;
startFilename = _fi[Lightnings_Extractor.Lightnings_Region.start].Name;
}
}
if (averagesOriginal > resultings[i - 35])
{
if (averagesOriginal[i+ 1] <= resultings[i - 35])
{
Lightnings_Extractor.Lightnings_Region.end = i;
endFilename = _fi[Lightnings_Extractor.Lightnings_Region.end].Name;
}
}
if (Lightnings_Extractor.Lightnings_Region.end == i)
{
lightnings++;
int x = Lightnings_Extractor.Lightnings_Region.end - Lightnings_Extractor.Lightnings_Region.start;
lightningsRegions.Add("Lightning " + lightnings.ToString() + " Length " + x.ToString() + " Start FileName: " + startFilename.ToString() + " End FileName: " + endFilename.ToString()); }
}
Lightnings_Extractor.Lightnings_Mode lightningsmode1 = new Lightnings_Extractor.Lightnings_Mode(this);
lightningsmode1.Show();
}
public void PlayLightnings()
{
button10.Enabled = true;
} [/code]
In the end the List<string> called lightningsRegions contain in this case 26 indexs for example index[0] looks like:
Lightning 1 Length 9 Start FileName 000151.bmp End FileName 000160.bmp
Now this is the new Form with a ListBox where i display this List lightningsRegions:
<pre class="prettyprint using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Polkan.DataSource;
using System.IO;
using unfreez_wrapper;
using WindowsFormsApplication1;
using DannyGeneral;
using System.Text.RegularExpressions;
using Extracting_Frames;
namespace Lightnings_Extractor
{
public partial class Lightnings_Mode : Form
{
string lightningName;
Form1 f1 = null;
public Lightnings_Mode(Form1 f1)
{
InitializeComponent();
this.f1 = f1;
}
private void Lightnings_Mode_Load(object sender, EventArgs e)
{
this.Size = new Size(416, 506);
this.Location = new Point(23, 258);
listBoxIndexs();
}
private void listBoxIndexs()
{
for (int i = 0; i < Form1.lightningsRegions.Count; i++)
{
listBox1.Items.Add(Form1.lightningsRegions);
}
}
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string item = listBox1.SelectedItem.ToString();
this.f1.PlayLightnings();
}
}
}[/code]
<br/>
Now in the listBox1_SelectedIndexChanged event i want to do that when i select an item lets say item in the first place index[0] wich is:
Lightning 1 Length 9 Start FileName 000151.bmp End FileName 000160.bmp
And in Form1 button10 is now enabled so i want to be able in Form1 to play in pictureBox1 all the files from 000151.bmp to 000160.bmp so when i click on the button10(Play) it will show me in Form1 pictureBox1 all the files: 000151,000152,000153,000154,000155,000156,000157,000158,000159,000160
Today in my code i have a Player already i cant play images in the pictureBox i have a timer already what i need here to make a Lisr ot maybe an Array of all the files from the selectedIndex fro example in the first selected index the array or List in form1
should contain all the files from 000151 to 000160 including 000151 and 000160
If i will select the second index in the listBox it should add to the array or List all the files in between the other two files start and end.
Thanks. <hr class="sig danieli
View the full article
<pre class="prettyprint private void toolStripComboBox2_SelectedIndexChanged(object sender, EventArgs e)
{
Calculations();
lightningsRegions = new List<string>();
int lightnings = 0;
//*** Start of lightning ***\
string f = Path.GetDirectoryName(fileName);
DirectoryInfo dir = new DirectoryInfo(f);
_fi = dir.GetFiles("*.bmp");
for (int i = 35; i < averagesOriginal.Count - 70; i++)
{
if (averagesOriginal <= resultings[i - 35])
{
if (averagesOriginal[i + 1] > resultings[i - 35])
{
Lightnings_Extractor.Lightnings_Region.start = i;
startFilename = _fi[Lightnings_Extractor.Lightnings_Region.start].Name;
}
}
if (averagesOriginal > resultings[i - 35])
{
if (averagesOriginal[i+ 1] <= resultings[i - 35])
{
Lightnings_Extractor.Lightnings_Region.end = i;
endFilename = _fi[Lightnings_Extractor.Lightnings_Region.end].Name;
}
}
if (Lightnings_Extractor.Lightnings_Region.end == i)
{
lightnings++;
int x = Lightnings_Extractor.Lightnings_Region.end - Lightnings_Extractor.Lightnings_Region.start;
lightningsRegions.Add("Lightning " + lightnings.ToString() + " Length " + x.ToString() + " Start FileName: " + startFilename.ToString() + " End FileName: " + endFilename.ToString()); }
}
Lightnings_Extractor.Lightnings_Mode lightningsmode1 = new Lightnings_Extractor.Lightnings_Mode(this);
lightningsmode1.Show();
}
public void PlayLightnings()
{
button10.Enabled = true;
} [/code]
In the end the List<string> called lightningsRegions contain in this case 26 indexs for example index[0] looks like:
Lightning 1 Length 9 Start FileName 000151.bmp End FileName 000160.bmp
Now this is the new Form with a ListBox where i display this List lightningsRegions:
<pre class="prettyprint using System;
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Polkan.DataSource;
using System.IO;
using unfreez_wrapper;
using WindowsFormsApplication1;
using DannyGeneral;
using System.Text.RegularExpressions;
using Extracting_Frames;
namespace Lightnings_Extractor
{
public partial class Lightnings_Mode : Form
{
string lightningName;
Form1 f1 = null;
public Lightnings_Mode(Form1 f1)
{
InitializeComponent();
this.f1 = f1;
}
private void Lightnings_Mode_Load(object sender, EventArgs e)
{
this.Size = new Size(416, 506);
this.Location = new Point(23, 258);
listBoxIndexs();
}
private void listBoxIndexs()
{
for (int i = 0; i < Form1.lightningsRegions.Count; i++)
{
listBox1.Items.Add(Form1.lightningsRegions);
}
}
private void listBox1_SelectedIndexChanged(object sender, System.EventArgs e)
{
string item = listBox1.SelectedItem.ToString();
this.f1.PlayLightnings();
}
}
}[/code]
<br/>
Now in the listBox1_SelectedIndexChanged event i want to do that when i select an item lets say item in the first place index[0] wich is:
Lightning 1 Length 9 Start FileName 000151.bmp End FileName 000160.bmp
And in Form1 button10 is now enabled so i want to be able in Form1 to play in pictureBox1 all the files from 000151.bmp to 000160.bmp so when i click on the button10(Play) it will show me in Form1 pictureBox1 all the files: 000151,000152,000153,000154,000155,000156,000157,000158,000159,000160
Today in my code i have a Player already i cant play images in the pictureBox i have a timer already what i need here to make a Lisr ot maybe an Array of all the files from the selectedIndex fro example in the first selected index the array or List in form1
should contain all the files from 000151 to 000160 including 000151 and 000160
If i will select the second index in the listBox it should add to the array or List all the files in between the other two files start and end.
Thanks. <hr class="sig danieli
View the full article