HostMike Posted July 9, 2003 Posted July 9, 2003 How do I change the icon on the main form? (icon in the top left corner) Quote
*Experts* mutant Posted July 9, 2003 *Experts* Posted July 9, 2003 Select the form, go to the propeties window and find the property called Icon. This will change it. Quote
HostMike Posted July 9, 2003 Author Posted July 9, 2003 Im not using Visual Studio, how would I change the icon in SharpDevelop?? Quote
*Experts* mutant Posted July 9, 2003 *Experts* Posted July 9, 2003 I dont know about sharp develop but here is how you can change it in code: Me.Icon = New Icon("iconfilepath") Quote
Leaders dynamic_sysop Posted July 9, 2003 Leaders Posted July 9, 2003 to add a new icon in c-sharp you can do this : private void menuItem1_Click(object sender, System.EventArgs e) { this.Icon=new Icon("C:\\7.ico"); '/// your icon path where it says "C:\\7.ico" } just incase anyone's interested :) Quote
HostMike Posted July 10, 2003 Author Posted July 10, 2003 hmm, another question, my program will crash if i do not move the icon file with the application, I was hoping that the icon would get compiled right into the code and then be pulled from there, what should I do?? I tried including the file in the project (using sharpdevelop .95) but it did not work. Any suggestions?? Quote
*Gurus* divil Posted July 10, 2003 *Gurus* Posted July 10, 2003 Yeah, get a better IDE :P Seriously, all you have to do is embed the icon in your project and then retrieve it at runtime and assign it to the form. SharpDevelop's Form Editor should take cake of this for you - if it's not, I would suggest posting on their forums as this seems to be an IDE issue. Quote MVP, Visual Developer - .NET Now you see why evil will always triumph - because good is dumb. My free .NET Windows Forms Controls and Articles
_SBradley_ Posted July 10, 2003 Posted July 10, 2003 C# [*]Embed the icon file as a resource in the application executable, using the appropriate command-line switch: /res:Blah.ico [*]Set the form's icon, something like this: Icon = new Icon(GetType().Assembly.GetManifestResourceStream("Blah.ico")); [/list=1] Voilà! Quote
*Experts* mutant Posted July 15, 2003 *Experts* Posted July 15, 2003 Dim ico As New Icon(System.Reflection.Assembly.GetExecutingAssembly.GetManifestResourceStream("NamespaceName.YourIcon.ico")) Substitute the NamespaceName with the name of the namespace your project is in. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.