Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / August 2007

Tip: Looking for answers? Try searching our database.

Icon Resource Problem

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Mark F. - 24 Aug 2007 19:18 GMT
In Visual Studio 6 you were able to create a separate icon for the
application and the document type. The complied executable would then have
two separate icons in the file.

I have not been able to figure out how to do this with VS 2005 for a C#
Windows Form project. Any tutorials or info on this?

Mark
Nicholas Paldino [.NET/C# MVP] - 24 Aug 2007 20:13 GMT
Mark,

   You should be able to set the icon on the project properties page, and
that will be the icon for the executable.

   If you want to have an icon in your executable which is used for file
associations, you will have to create a win 32 resource file, and then
compile it into your app.  From the command line, you will compile your app
and then use the /win32res switch to attach the .res file to the executable.
Then, in your file association registry settings, you can point to your
executable and the resource id of the icon.

Signature

         - Nicholas Paldino [.NET/C# MVP]
         - mvp@spam.guard.caspershouse.com

> In Visual Studio 6 you were able to create a separate icon for the
> application and the document type. The complied executable would then have
[quoted text clipped - 4 lines]
>
> Mark
Mark F. - 24 Aug 2007 22:00 GMT
> Mark,
>
[quoted text clipped - 7 lines]
> executable. Then, in your file association registry settings, you can
> point to your executable and the resource id of the icon.

Nicholas,

I created an .rc file then compiled it. Then included the .res file in my
project. With the DefaultIcon indexes set to 0 and 1 (app and document
respectively), the file icons are displayed correctly in Explorer.

Thanks for the help!
Mark
Peter Duniho - 24 Aug 2007 20:15 GMT
> In Visual Studio 6 you were able to create a separate icon for the
> application and the document type. The complied executable would then have
> two separate icons in the file.
>
> I have not been able to figure out how to do this with VS 2005 for a C#
> Windows Form project. Any tutorials or info on this?

Are you using the Express Edition?

My recollection is that support for resource types is limited in
Express.  In my version of VS 2005 Pro, I have no trouble creating as
many icon resources in the application as I like.

Even in Express, you should be able to add pre-existing icon files as
resources though.  The limitation I recall has more to do with editing
them than in adding them.

The basic steps are easy: just double-click on the "Resources" item
under "Properties" in your project, and that will show the resource
editing UI.  In there, you should be able to add new resources,
including icon files.

Pete
Husam Al-A''araj - 24 Aug 2007 20:16 GMT
Hi mark,
Like a bitmap, an icon is used to display graphics on window objects. While
a bitmap can have any dimension the window needs, the size of an icon is
limited. This is because icons assume different roles on an application.

to create a sererated icon, please follow the below link, i hope it will
help you.

http://www.functionx.com/vcsharp/gdi/icons.htm

Regards,
Husam Al-A'araj
www.aaraj.net

> In Visual Studio 6 you were able to create a separate icon for the
> application and the document type. The complied executable would then have
[quoted text clipped - 4 lines]
>
> Mark

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.