Friday 15 March 2013

c# - Setting the form icon for an XNA window? -


Is there any way to change the icon for an XNA game form (i.e., which appears in the top left corner , And on the taskbar)?

I currently have a multi-icon that is embedded in different sizes, including 16x16 one. Unfortunately the project property uses "apps -> resources -> icon and manifest" 32x32 and instead it scales down instead of the original one.

I want to set the icon manually to use 16x16 I am in the icon, and if possible, change it dynamically on run-time.

Thank you. After reading

  Fixed Zero main (string [] args) {using (game1 game = new game1 ()) {((System.Windows.Forms.Form) System.Windows.Forms.Form.FromHandle (game.Window.Handle)). Icon = New system Drawing Icon ("file.ico"); Game.Run (); }}  

file.ico should be copied to the same location as your executable location.

You have to refer to these assemblies in your solution:

  • System.Windows.Forms
  • System.Drawing

You can also change Game.ico in your Solutions folder, which is the same effect.


No comments:

Post a Comment