thecruz
asked on
How can i make my pictures display in sequence along with my videos?
I'm trying to create a windows form that would allow me to display my pictures and video in sequence. Please look at the following code and let me know how i could restructure this code to do what i am trying to do:
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
filemax = 0;
panel1.Controls.Clear();
foreach (string files in Directory.GetFiles(dlg.Sel ectedPath) )
{
if (files.EndsWith(".jpg") || files.EndsWith(".jpeg") || files.EndsWith(".avi") || files.EndsWith(".mpeg"))
{
//PictureBox pb = new PictureBox();
//Image img = Image.FromFile(files);
//pb.Image = img;
//panel1.Controls.Add(pb);
listView1.Items.Add(files) ;
}
//else
//{
// if (()
// {
// axWindowsMediaPlayer1.URL = files;
// }
//}
filemax++;
}
timer1.Enabled = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (filecount == filemax)
{
filecount = 0;
}
PictureBox p = (PictureBox)panel1.Control s[filecoun t];
pictureBox1.Image = p.Image;
filecount++;
}
private void button2_Click(object sender, EventArgs e)
{
FolderBrowserDialog dlg = new FolderBrowserDialog();
if (dlg.ShowDialog() == DialogResult.OK)
{
filemax = 0;
panel1.Controls.Clear();
foreach (string files in Directory.GetFiles(dlg.Sel
{
if (files.EndsWith(".jpg") || files.EndsWith(".jpeg") || files.EndsWith(".avi") || files.EndsWith(".mpeg"))
{
//PictureBox pb = new PictureBox();
//Image img = Image.FromFile(files);
//pb.Image = img;
//panel1.Controls.Add(pb);
listView1.Items.Add(files)
}
//else
//{
// if (()
// {
// axWindowsMediaPlayer1.URL = files;
// }
//}
filemax++;
}
timer1.Enabled = true;
}
}
private void timer1_Tick(object sender, EventArgs e)
{
if (filecount == filemax)
{
filecount = 0;
}
PictureBox p = (PictureBox)panel1.Control
pictureBox1.Image = p.Image;
filecount++;
}
Hi,
And as concerned for video files (.avi, .mpeg) you cannot get them in pictureBox, there must be other control to do that.
Regards,
V.S.Saini
And as concerned for video files (.avi, .mpeg) you cannot get them in pictureBox, there must be other control to do that.
Regards,
V.S.Saini
You can use AJAX slide show control to display pictures.
AJAX Slide Show Control
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/SlideShow/SlideShow.aspx
http://aspalliance.com/1266_Video_Using_the_ASPNET_AJAX_Control_Toolkit_Slide_Show_Control.all
AJAX Slide Show Control
http://www.asp.net/ajax/ajaxcontroltoolkit/Samples/SlideShow/SlideShow.aspx
http://aspalliance.com/1266_Video_Using_the_ASPNET_AJAX_Control_Toolkit_Slide_Show_Control.all
ASKER
sorry for the lack of detail guys. i'm using the windows media control but at the moment i'm not sure how to write the code so that the timer opens the files. i need to be able to do a slideshow of picture but in the event that a video is found in the directory be able to play it with the windows media control. Ones the video is done playing resume showing the pictures.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
thanks for the code provided but when i run it i get the following attached error.
error.JPG
error.JPG
Hi,
I tested the same all in VS 2005, VS 2010 also. It's working fine.
Check screenshot and verify if you are having both (first and last) reference in the list in your program.
And make those lines as comment which are causing problem. And test the rest of code if it is working fine or not. And try to delete all .exe files from bin folder and then execute your program fresh.
public Form1()
{
InitializeComponent();
//axWindowsMediaPlayer1.St atusChange += new EventHandler(axWindowsMedi aPlayer1_S tatusChang e);
}
// void axWindowsMediaPlayer1_Stat usChange(o bject sender, EventArgs e) // { // Restart playing all items in playlist // axWindowsMediaPlayer1.Ctlc ontrols.pl ay(); // }
Regards,
V.S.Saini
See.bmp
I tested the same all in VS 2005, VS 2010 also. It's working fine.
Check screenshot and verify if you are having both (first and last) reference in the list in your program.
And make those lines as comment which are causing problem. And test the rest of code if it is working fine or not. And try to delete all .exe files from bin folder and then execute your program fresh.
public Form1()
{
InitializeComponent();
//axWindowsMediaPlayer1.St
}
// void axWindowsMediaPlayer1_Stat
Regards,
V.S.Saini
See.bmp
ASKER
excelent
ASKER
one las question. Is there a way to rotate images in Windows media?
Hi,
I have to search that code. I will reply either with code or with my result of yes or no within two hours.
Regards,
VSS
I have to search that code. I will reply either with code or with my result of yes or no within two hours.
Regards,
VSS
ASKER
Thanks for you prompt response.
ASKER
Please if you do not mind. I'm adding the path to the video files to the listview control but i cant figure out how to add an image to each row or item. here is the code i'm using:
listView1.Items.Clear();
foreach (string files in Directory.GetFiles(dlg.Sel ectedPath) )
{
if ((files.EndsWith(".avi")) || files.EndsWith(".mpeg"))
{
listView1.Items.Add(files) ;
}
}
How can i add an image and only list the name of the file not the whole path?
listView1.Items.Clear();
foreach (string files in Directory.GetFiles(dlg.Sel
{
if ((files.EndsWith(".avi")) || files.EndsWith(".mpeg"))
{
listView1.Items.Add(files)
}
}
How can i add an image and only list the name of the file not the whole path?
Hi,
Check link:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/876b6517-7306-44b0-88df-caebf3b1c10f for your first question to how to add an image.
And to list the name of the file not full path use the property of FileInfo object as file.Name.
Regards,
VSS
Check link:
http://social.msdn.microsoft.com/Forums/en-US/winforms/thread/876b6517-7306-44b0-88df-caebf3b1c10f for your first question to how to add an image.
And to list the name of the file not full path use the property of FileInfo object as file.Name.
Regards,
VSS
Hi,
I searched lot on net and found that even in simply playing Window Media Player we cannot rotate our video files. So the same cannot be done in programming too because here we are just trying to control those features in our application.
There on internet they say we need to use Windows Movie Maker software to first convert it into other format means to tild in other way. However I would like to know out of curiosity the reason behind for rotating images.
I also find a nice link : http://www.codeproject.com/KB/graphics/TimeLine.aspx?msg=2879335
where Author have described about creating a nice player. If you need something advance in context of look and working you can check it.
Happy Coding!
Regards,
VSS
I searched lot on net and found that even in simply playing Window Media Player we cannot rotate our video files. So the same cannot be done in programming too because here we are just trying to control those features in our application.
There on internet they say we need to use Windows Movie Maker software to first convert it into other format means to tild in other way. However I would like to know out of curiosity the reason behind for rotating images.
I also find a nice link : http://www.codeproject.com/KB/graphics/TimeLine.aspx?msg=2879335
where Author have described about creating a nice player. If you need something advance in context of look and working you can check it.
Happy Coding!
Regards,
VSS
ASKER
Me and my wife take a lot of picture and unfortunately when we are viewing the pics we have to rotate them constantly. My main reason for creating the program is because i'm tired of using the windows explorer slide show and i don't want to have to plug in my camera to the TV every time we want to see picture with their sequenced videos.
Please check the link:
http://www.attilan.com/2008/12/crystal-image-toolkit-100-rele.php
and also have look on code. But only for slideshow of pictures.
Regards,
V.S.Saini
Open in new window