2014-03-05 63 views
0

我有winforms應用程序,我有紋理SimpleTexture.xnb編譯爲HiDef。我需要在單獨的窗口中從我的winforms應用程序運行XNA 3D可視化。我試試這個:如何從winforms運行hidef XNA?

private void button1_Click(object sender, EventArgs e) 
    { 
     System.Threading.Thread thStartGame = new System.Threading.Thread(StartGame); 
     thStartGame.Start(); 
    } 

    private void StartGame() 
    { 
     using (Game1 game = new Game1()) 
     { 
      game.Run(); 
     } 
    } 

,但我得到的錯誤: 錯誤加載 「SimpleTexture」。該文件是爲HiDef配置文件編譯的,無法加載到Reach GraphicsDevice中。

我能做些什麼來運行?

回答

0

變化達到hidef:

YourGraphicsDeviceManager.PreparingDeviceSettings += new EventHandler<PreparingDeviceSettingsEventArgs (graphics_PreparingDeviceSettings); 

void graphics_PreparingDeviceSettings(object sender, PreparingDeviceSettingsEventArgs e) 
{ 
    e.GraphicsDeviceInformation.GraphicsProfile = GraphicsProfile.HiDef; 
}