【问题标题】:Why i'm getting error on the Microsoft.DirectX.Direct3D.Device?为什么我在 Microsoft.DirectX.Direct3D.Device 上出现错误?
【发布时间】:2016-11-01 00:38:44
【问题描述】:

整个代码很长。 因此,我将仅在此处添加相关行。

在表格顶部:

private Device D3Ddev = null;

设备是 Microsoft.DirectX.Direct3D.Device

然后:

private Boolean InitializeDirectX()
        {

                DispMode = Manager.Adapters[Manager.Adapters.Default.Adapter].CurrentDisplayMode;
                D3Dpp = new PresentParameters();
                D3Dpp.BackBufferFormat = DispMode.Format;
                D3Dpp.PresentFlag = PresentFlag.LockableBackBuffer;

                D3Dpp.SwapEffect = SwapEffect.Discard;
                D3Dpp.PresentationInterval = PresentInterval.One; //wait for vertical sync. Synchronizes the painting with
                //monitor refresh rate for smoooth animation
                D3Dpp.Windowed = true; //the application has borders

            try
            {
                D3Ddev = new Device(Manager.Adapters.Default.Adapter, DeviceType.Hardware, pictureBox1.Handle,
                                                                           CreateFlags.SoftwareVertexProcessing, D3Dpp);
                D3Ddev.VertexFormat = CustomVertex.PositionColored.Format;
                D3Ddev.RenderState.Lighting = false;
                D3Ddev.RenderState.CullMode = Cull.CounterClockwise;

                backTexture = TextureLoader.FromStream(D3Ddev, mymem);
                scannedCloudsTexture = new Texture(D3Ddev, 512, 512, 1, Usage.Dynamic, Format.A8R8G8B8, Pool.Default);

                //sprite is used to draw the texture
                D3Dsprite = new Sprite(D3Ddev);

                return true;
            }
            catch
            {
                Logger.Write("error");
                return false;
            }
        }

错误就行了:

D3Ddev.VertexFormat = CustomVertex.PositionColored.Format;

关于格式。

严重性代码描述项目文件行抑制状态 错误 CS0012 类型“IsConstModifier”在未引用的程序集中定义。您必须添加对程序集“Microsoft.VisualC, Version=7.0.5000.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a”的引用。 DopplerEffect.cs 467 活动

【问题讨论】:

  • 托管 DirectX 库非常非常古老,并且在 .NET 2.0 发布之前就停止了。微软不再想支持它,那不是因为它是一个很棒的库。你缺少一个依赖,回到 Visual Studio 2002。继续使用这个库的开源替代品,比如 SharpDX 和 SlimDX。

标签: c# .net winforms


【解决方案1】:

正如它所说,您需要添加对程序集“Microsoft.VisualC”的引用。

在“C:\Windows\Microsoft.NET\Framework\v2.0.50727\Microsoft.VisualC.dll”中搜索某处

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2017-11-03
    • 2019-07-07
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-05-23
    • 2018-01-20
    • 1970-01-01
    相关资源
    最近更新 更多