Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Different icons in .NET application

ColdShineColdShine Posts: 597Member
I'm getting mad trying to figure this out.
How do you embed more than 1 icon in the .EXE? There's the /win32icon option to embed a single icon, but I want the program to have 2 icons (one for the program itself, the other for the associated document type).
I think I should insert it into a .RC file, but I can't figure how to do this. Can anyone help me out?

Thanks,
________________
[size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]

Comments

  • pingpongpingpong Posts: 937Member
    : I'm getting mad trying to figure this out.
    : How do you embed more than 1 icon in the .EXE? There's the /win32icon option to embed a single icon, but I want the program to have 2 icons (one for the program itself, the other for the associated document type).
    : I think I should insert it into a .RC file, but I can't figure how to do this. Can anyone help me out?
    :
    : Thanks,
    : ________________
    : [size=1][b][grey]Cold[/grey][blue]Shine[/blue][/b][/size]
    :

    The easiest way:
    1. Start a new project.
    2. Add the icons to your project (Add Existing Item).
    3. Select them and change the build action to "Embedded Resource".
    4. In your Form1, add a paint handler and do this:

    Icon icon = new Icon(typeof(Form1), "something.ico");
    e.Graphics.DrawIcon(icon, 10, 10);

    Note, "something.ico" is the name of the icon file you embedded, case sensitive.

    If you create a folder and add the icons to this folder, you need to do this:
    Icon icon = new Icon(typeof(Form1), "folder_name.something.ico");
    It's a fully qualified namespace.

    Same thing goes for the first parameter, the Type.

Sign In or Register to comment.