newbie icon question

  • Thread starter Thread starter SStory
  • Start date Start date
S

SStory

OK... Just don't get it yet....

I have a form and want to use 1 of 2 different icons depending on how it is
called.

If I put my icons in an imagelist, they become bitmaps and can't set the
form

me.icon= to them

seems to be no way to convert from bitmap to icon and can't figure out how
to just store both icons as icons to switch back and forth inside the
constructor where I will know which to use.

Please help me undestand if there is an easy way to do this.... I'm sure
there must be.

thanks,

Shane
 
Hi SStory,

I do it in this way, but don't find it nice either, but it is very easy

Private busyIcon As New System.Drawing.Icon("icoBusy.ico")

myIcon = buyIcon

Cor
 
Add the Icons to the project and set their [Build Action] property to
[Embedded Resource].
Then set the Icon as follows (Where MyNameSpace is the Namespace of your
project and MyIcon.ico is the name of your embedded icon):

\\\
Imports System.Reflection.Assembly

Me.Icon = New Icon(GetExecutingAssembly. _
GetManifestResourceStream( _
"MyNameSpace.MyIcon.ico"))
///

To create an Icon from Bitmap use the following:

\\\
Me.Icon = Icon.FromHandle(MyBitmap.GetHicon)
///
 
hey great answers.... Thanks... I have been wondering how to do this for
some time.

Could you explain the system.reflection.assembly?

Does that just have to do with a program looking at itself?

Ok...

Thanks

Shane



"Mick Doherty"
Add the Icons to the project and set their [Build Action] property to
[Embedded Resource].
Then set the Icon as follows (Where MyNameSpace is the Namespace of your
project and MyIcon.ico is the name of your embedded icon):

\\\
Imports System.Reflection.Assembly

Me.Icon = New Icon(GetExecutingAssembly. _
GetManifestResourceStream( _
"MyNameSpace.MyIcon.ico"))
///

To create an Icon from Bitmap use the following:

\\\
Me.Icon = Icon.FromHandle(MyBitmap.GetHicon)
///

SStory said:
OK... Just don't get it yet....

I have a form and want to use 1 of 2 different icons depending on how it is
called.

If I put my icons in an imagelist, they become bitmaps and can't set the
form

me.icon= to them

seems to be no way to convert from bitmap to icon and can't figure out how
to just store both icons as icons to switch back and forth inside the
constructor where I will know which to use.

Please help me undestand if there is an easy way to do this.... I'm sure
there must be.

thanks,

Shane
 
Back
Top