If you use the XNA Game class, it creates its own form and the DirectX surface will take up the entire form so you cannot easily add other Windows Forms controls. There is a sample on the following blog about hosting an XNA window inside of a Windows Forms PictureBox control, which would allow you to place it and size it as you like, and add other controls, but you sacrifice the features of the Game class, such as automatic GPU device management:
http://tonigreco.spaces.live.com/
Also, if you are drawing 20,000 unique objects, then your performance is not likely to be better with XNA. The CPU becomes a bottleneck when you have large numbers of Draw() calls. To improve your performance you would need to either merge some of the objects together so they can be drawn with a smaller number of Draw() calls, or if many of the objects are duplicates of each other, you could use a technique known as hardware instancing. There is a C++ example in the DirectX SDK that demonstrates hardware instancing. You may also find it helpful to read the following forum post which discusses this sort of problem:
http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=1242843&SiteID=1
kyle_w
| Thu, 13 Sep 2007 14:10:00 GMT |