为什么我在Microsoft.DirectX.Direct3D.Device上收到错误?

时间:2016-11-01 00:38:44

标签: c# .net winforms

整个代码很长。 所以我在这里只添加相关的行。

在表格的顶部:

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 Active

1 个答案:

答案 0 :(得分:3)

因为它声明你需要添加对程序集“Microsoft.VisualC”的引用。

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