How to add a DirectX reference in Visual Studio 2010 [closed]

做~自己de王妃 提交于 2019-12-03 07:14:30

问题


How can I add a DirectX reference to my C# project in Visual Studio 2010? Thanks.


回答1:


  1. Go to the solution explorer
  2. Click references
  3. Click add reference
  4. Click Browse
  5. Browse to:

    C:\WINDOWS\Microsoft.NET\DirectX for Managed Code\1.0.2902.0\

  6. Select your directX package.




回答2:


DirectX is for unmanaged code - C++. To use it from C# you need to find a wrapper library for it. The two best right now are SlimDX and SharpDX. Grab the binaries from the sites and just add a reference to them.




回答3:


There is one way i have find. First you need to install DXSDK (i have June2010 and SDK for Windows 7). Go to "Add reference" dialog press "Browse" , go to somthing like this C:\Windows\Microsoft.NET\DirectX for Managed Code\1.0.2902.0 or C:\Windows\Microsoft.NET\Managed DirectX\v9.02.2904 then choose proper dll for example - Microsoft.DirectX.dll. So you can add "using Microsoft.DirectX" directive to your project. All done.




回答4:


You can also use the Windows API code pack from http://code.msdn.microsoft.com/WindowsAPICodePack. Then, look at the article http://blogs.msdn.com/b/msaleh/archive/2009/08/25/introducing-directx-features-of-windows-api-code-pack.aspx, and you should be started. (the article talks about VS2008, but it works on VS2010 too)

Good luck....




回答5:


We use managed directx too. You should download DirectX Software Development Kit: http://www.microsoft.com/downloads/en/details.aspx?FamilyID=c72d9f1e-53f3-4747-8490-6801d8e8b4ef

Dlls for using DirectX in managed code have included into it.



来源:https://stackoverflow.com/questions/4414474/how-to-add-a-directx-reference-in-visual-studio-2010

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!