user38275
user38275

Reputation: 31

Video clip does not release the form on ending

I have the following code which plays a video clip but when it is finished it does not release the form but instead leaves the last frame of the video. how do I get it to clear when playback ends so that I can see the orignal contents of the form it took over to play the video?

_video = new Video("video.wmv");
_video.Owner = frmVideoWindow;
_video.Play();

Upvotes: 2

Views: 295

Answers (2)

user38275
user38275

Reputation: 31

Daok pointed me in the correct direction. An event handler on the video ending and then setting the Owner of the Video object to null.

_video.Ending += new System.EventHandler(this.video_stopped);

private void video_stopped(object sender, EventArgs e)
{
    _video.Owner = null;
}

Upvotes: 1

Patrick Desjardins
Patrick Desjardins

Reputation: 140843

Release the form you mean to close it? You might want to check for an event in your Video object that will raise when the video is done and you will need to use this.close(); to close the form. Is it what you desire?

Upvotes: 0

Related Questions