C # - Solution for Winform's inability to establish windows when using Video in DirectX

[C #] Solution for Winform's inability to create windows when using Video in DirectX

Problem description: .

In order to leverage Microsoft in DirectX DirectX AudioVideoPlayback is used to implement the function of playing videos, and a Panel control and a button are established in the window.


]After referencing DirectX in the code, define a Video


The following usage will no longer be demonstrated. The problem is that when starting, it was found that the Form1 window did not appear. After several confirmations, it was found that it could not be started after defining Video.

Solution: .

If a LoaderLock exception occurs, tick it off, which does not affect
If there is no configuration file (App. config), create it. If there is


Then in< Startup> Add in.

UseLegacyV2RuntimeActivationPolicy= "True".

For example:
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup useLegacyV2RuntimeActivationPolicy="true">
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>.