Different icons in .NET application - Programmers Heaven

Howdy, Stranger!

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

Categories

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.