C# 初始化Direct3D.Device时抛出带有E_NOTIMPL的GraphicsException

C# 初始化Direct3D.Device时抛出带有E_NOTIMPL的GraphicsException,c#,directx,visual-studio-2015,direct3d,C#,Directx,Visual Studio 2015,Direct3d,我使用DirectX SDK用C#编写了一个应用程序。它工作正常,但在重新安装操作系统后,就没有了。 当我尝试初始化Microsoft.DirectX.Direct3D.Device时,它抛出Microsoft.DirectX.Direct3D.GraphicsException 错误代码:-2147467263(0x80004001) 错误字符串:E_NOTIMPL Windows Embedded 8.1 Industry Pro(但以前它在同一系统上工作-在重新安装之前) Visual S

我使用DirectX SDK用C#编写了一个应用程序。它工作正常,但在重新安装操作系统后,就没有了。
当我尝试初始化Microsoft.DirectX.Direct3D.Device时,它抛出Microsoft.DirectX.Direct3D.GraphicsException 错误代码:-2147467263(0x80004001)
错误字符串:E_NOTIMPL

Windows Embedded 8.1 Industry Pro(但以前它在同一系统上工作-在重新安装之前)

Visual Studio 2015社区(或Visual Studio 2013专业版-同样的问题)

代码如下:

        PresentParameters pp = new PresentParameters();
        pp.SwapEffect = SwapEffect.Discard;
        pp.Windowed = true;
        device = new Device(0, DeviceType.Hardware, this, CreateFlags.SoftwareVertexProcessing, pp);

我刚刚发现了我的错误。我把设备放在一个控件中,而控件没有任何形式。在我将控件添加到主窗体之后,它就可以工作了。 下面是代码示例:

public Form1()
{
  //Some other staff
  this.Controls.Add(myDirect3DControl);
  //After that I can initialize the device
}

请注意,托管DirectX 1.1程序集(从C#到传统DirectX SDK使用DirectX的唯一方法)已被弃用多年。我强烈建议移动到受支持的对象,例如或。看。