Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Custom form class: icon property
Message
From
22/03/2005 13:13:03
 
General information
Forum:
ASP.NET
Category:
Forms
Miscellaneous
Thread ID:
00998076
Message ID:
00998187
Views:
15
Einar,

Well, if you really want to be masochistic, there *is* some way of getting an image/icon/whatever into the resource (System.Resource.ResourceManager), but I don't know how off the top of my head ... I think it's a bit more complicated than just than a few lines of code (and I've never had to do it, so don't quote me on that <g>).

~~Bonnie




>Bonnie,
>That is what I figured someone would say. I was hoping I could just use code and not have to use the designer for this, but oh well.
>
>Einar
>>Einar,
>>
>>Set the icon with the Form's icon property from the Property Sheet instead of in code. It will embed it that way.
>>
>>~~Bonnie
>>
>>
>>
>>>I found something that I didn't expect today when running an app on my test computer. I created a very basic form class, just setting the backcolor and the icon property. See code below:
>>>
>>>
>>>public class alsForm: System.Windows.Forms.Form
>>>{
>>>	public override Color BackColor
>>>	{
>>>		get{return base.BackColor;}
>>>		set{;}
>>>	}
>>>
>>>	public alsForm()
>>>	{
>>>		base.BackColor = ALS.Subclass.Controls.alsDefaultSettings.alsBACK_COLOR;
>>>		base.Icon = new Icon(@"C:\work\Images\Icon\Alliance_Logo.ico");
>>>	}
>>>}
>>>
>>>
>>>If I use this alsForm in my project things are looking great, but if I try to run the exe on a different computer an exception is thrown stating, quite correctly, that the icon can not be found in the location C:\work\Images\Icon\Alliance_Logo.ico.
>>>
>>>Why isn't the icon built into the exe? How can I force the icon to be built into the exe?
>>>
>>>
>>>Thanks,
>>>Einar
>>>
>>>Update: I want to use the same icon on all the forms as the icon I select for the exe icon.
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform