jagarciauceda's picture

Game Window Icon

Hello everyone!!

I have a problem. I want change the icon that appears in my game window and put my own icon. but I don't know how do it. I have searched during a lot of hours in google, but I haven't found anything, anybody knows how do this?¿

Thanks and Happy Christmas!!

Inline Images

Comments

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
the Fiddler's picture

There are two ways to do this:

  • use the GameWindow.Icon property to load an icon at runtime (System.Drawing.Icon)
  • set the icon resource in your application properties

I would strongly recommend the latter, as that will also change the icon of the executable file on the disk (on Windows). The Icon property is only necessary if you with to change the icon at runtime.

jagarciauceda's picture

Hi!!! Thanks!!! your are very quick!!

I have tried to do this but only change the "executable icon". The window Icon no disapear is like a virus!! ha ha. I don't have the Manifest like you (app.manifest) maybe is this?¿

....and when I put in the "Out type" : Console application, changes the icon's console window (great) but not in my game window....Sad, very sad

the Fiddler's picture

I was pretty sure that this would change all icons. My bad.

The solution is still pretty simple: go to your Project Properties -> Resources -> Add Resource -> Add New Icon. Navigate to your icon, select it and click Add.

Now all you need to do is set the Icon property of your GameWindow, like this:

this.Icon = MyNamespace.Properties.Resources.MyIcon;

Replace "MyNamespace" and "MyIcon" with the real namespace and icon name for your application and you are done!

jagarciauceda's picture

Works!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! XD

I didn't have this line this .Icon = MyNamespace.Properties.Resources.MyIcon; so, now I am super happy and my application looks better :D

Many Thanks the Fiddler !!!!!!!!!!!!! Tonight I will sleep good!!!