DirectX Video in a picturebox - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

DirectX Video in a picturebox

polakospolakos Posts: 1Member
I am trying to show a slideshow that has the ability to play movies. The slideshow works fine (runs off a timer). I added a picturebox and made a directx video its child. When I run the slideshow, the pictures show up fine until the movie comes. The movie plays, but the last frame of the movie covers the picturebox and allows no more pictures to show. Below is a code snip. I was wondering if anyone knew why the picturebox does not resume normal operation after the video object is disposed?

//In timer tick function
switch (ext)
{
case "jpg":
pictureBox.Visible = true;
pictureBox.SizeMode = PictureBoxSizeMode.Zoom;
pictureBox.ImageLocation = currentPacket.thePayload.file;
pictureBox.Invalidate();

//Setup timer for next slide request
myTimer.Stop();
myTimer.Interval = (double)(pkt.thePayload.duration) * 1000;
myTimer.Start();
break;

case "mpg":
pictureBox.Visible = true;
videoDisplay = new Video(currentPacket.thePayload.file, false);
videoDisplay.Size = pictureBox.Size;
videoDisplay.Owner = pictureBox;
videoDisplay.Ending += new EventHandler(videoDisplay_Ending);
videoDisplay.Play();
myTimer.Stop();
break;
}

//This function starts the next slide when the video stops playing
void videoDisplay_Ending(object sender, EventArgs e)
{
SlideTimerTick(null, null);
//Setup timer for next slide request
myTimer.Stop();
myTimer.Interval = 5000;
myTimer.Start();
}
Sign In or Register to comment.