In C # programming, because a function needs to play a small section of the AVI format of the short film, the result of looking for a half-day also did not fix how to play. So I check on the Internet Ah! Looking for half a day finally found a way to play the file.
His way is to first use the following command for the media Player control: Msdxm.ocx generates MediaPlayer.dll and AxMediaPlayer.dll. The command is: AxImp c:\winnt\system32\msdxm.ocx and often ActiveX controls in Msdxm.ocx are not registered! Then run regsvr32 msdxm.ocx Manual registration to generate the required dynamic connection library files.
But I found that the MediaPlayer control he used was a lot of media files that could be played. But it doesn't satisfy the situation I need. My situation is to use C # to play a small section of AVI file, and the background to be transparent, not black, or other colors, I looked for a half-day can not find any way to make MediaPlayer playback of the file for the transparent state, very depressed!
But then I found that other use VB program can realize this function, let me very happy, so I opened the VB code for a detailed view, found in VB has a control for animation can play AVI file, and it has a property option is to make the background transparent. Just to meet my needs. But this is also an OCX control, so I first found the control, the location is: C:\WINDOWS\SYSTEM32\COMCT32.ocx, and then I run regsvr32 manual registration, after registration I will be in the environment to quote, The following figure:
(However, later I found that this is not regsvr32 registration, because.) NET early already registered, depressed in ~~~~~~~~~~~~~~)
Then drag the control into the form, make the layout, set its property autoplay to true, and then write the following sentence in your code:
private void Form1_Load(object sender, System.EventArgs e)
{
this.axAnimation1.Open(Application.StartupPath + @"\FILECOPY.AVI");
}
This will automatically play this small section of AVI file when the form is loaded.
In fact, this problem is not very difficult, mainly I am not particularly familiar with the COM component. As long as you are familiar with the functions of these components, as well as the principle of operation, it is bound to greatly improve the efficiency of our programming.