Clearing a Windows Forms panel containing a DirectX movie

To Whom It May Concern

I am finalizing an application that uses .NET 1.1 and DirectX with a mpeg or avi movie displaying a video of a particular road and section. When I navigate to another road section the panel is not cleared unless another movie is selected. I have tried the dispose method without any luck. My current code is as follows:

// dispose of the old video to clean up resources

if (video!=null)

{

video.Dispose();

//video = null;

//videoPanel.Refresh();

videoPanel.Controls.Clear();

//videoPanel.Dispose();

//videoPanel.Update();

}

// open a new video

video = new Video(file);

// assign the win form control that will contain the video

video.Owner = videoPanel;

// resize to fit in the panel

videoPanel.Width = width;

videoPanel.Height = height;

// play the first frame of the video so we can identify it

video.Play();

video.Pause();

Could someone please advise me if there is another alternative. I am trying to finalize the software for release within the next week.

yours sincerely

Craig Hoy




Answer this question

Clearing a Windows Forms panel containing a DirectX movie

  • Zero_

    You should just be able to reset the directX Device and not redraw to it.



  • jakeb16

    //Clear the backbuffer to a blue color
    device.Clear(ClearFlags.Target, System.Drawing.Color.Blue, 1.0f, 0);

    The above line clears the device..



  • DoctorWho

    I attempted to clear the device the other day but it did not work. Which class & method contains the device.clear as a root method I am using Visual Studio 2003 for this job and neither the Panel or DirectX.Video class contained the clear method that was mentioned in the last post. Once again I will post the code that I am working on. It is as follows:

    if (video!=null)

    {

    video.Dispose();

    //video = null;

    //videoPanel.Refresh();

    //videoPanel.Controls.Clear();

    //videoPanel.Dispose();

    //videoPanel.Update();

    videoPanel.ForeColor = System.Drawing.Color.Blue;

    videoPanel.BackColor = System.Drawing.Color.Blue;

    videoPanel.Refresh();

    }

    yours sincerely

    Craig Hoy



  • Ian Barber

    Could someone please assist me as I am desperate to fix the bug!

    yours sincerely

    Craig Hoy



  • Corby111

    Unfortunately that is what I have been doing all along and it basically did not do what I required. I have been trying to use Dispose, Update, Refresh & setting the object to null with no avail.

    yours sincerely

    Craig Hoy



  • Clearing a Windows Forms panel containing a DirectX movie