drawing an icon on a form
-
Hi guys, I'm trying to draw an icon onto the surface of a form. What I do is create the icon in the bitmap editor in VS.NET and then perform the following in my Form's code
private Icon myIcon
...
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
myIcon = ((System.Drawing.Icon)(resources.GetObject("icon1.ico")));
...myIcon
however is alwaysnull
It's a simple matter I'm sure but I'm brain dead at the moment. How can I make sure that I have a valid icon instance in this case? Regards Senkwe Just another wannabe code junky -
Hi guys, I'm trying to draw an icon onto the surface of a form. What I do is create the icon in the bitmap editor in VS.NET and then perform the following in my Form's code
private Icon myIcon
...
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
myIcon = ((System.Drawing.Icon)(resources.GetObject("icon1.ico")));
...myIcon
however is alwaysnull
It's a simple matter I'm sure but I'm brain dead at the moment. How can I make sure that I have a valid icon instance in this case? Regards Senkwe Just another wannabe code junkyJust looking at form designer generated code I get this:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
I seems like it gets the icon out of the associated resx file. -- Peter Stephens
-
Just looking at form designer generated code I get this:
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
I seems like it gets the icon out of the associated resx file. -- Peter Stephens
Thans, I'll give that a try Regards Senkwe Just another wannabe code junky