Home All Groups Group Topic Archive Search About
Author
31 Mar 2005 9:43 PM
OpticTygre
When you create a new component, compile it, and add it to the toolbox, it
comes with that boring gearbox icon next to it.  How can you change the icon
associated with a new component you create?

Author
31 Mar 2005 10:35 PM
Crouchie1998
Imports System.ComponentModel

<ToolboxBitmap("C:\MyPic.bmp")> _
Public Class MyClass
....
End Class

Obviously, the bitmap file is the path to your bitmat for the toolbox icon.

I hope this helps
Author
31 Mar 2005 10:57 PM
OpticTygre
Hmm...instead of referring to a static place on the drive, can I integrate
it into the DLL I create?  Like, if I add the bitmap or icon to my project,
can I refer to it that way, rather than on the drive of the computer?


Show quoteHide quote
"Crouchie1998" <crouchie1***@discussions.microsoft.com> wrote in message
news:OX06kIkNFHA.688@TK2MSFTNGP10.phx.gbl...
> Imports System.ComponentModel
>
> <ToolboxBitmap("C:\MyPic.bmp")> _
> Public Class MyClass
> ...
> End Class
>
> Obviously, the bitmap file is the path to your bitmat for the toolbox
> icon.
>
> I hope this helps
>
>
Author
31 Mar 2005 10:54 PM
Herfried K. Wagner [MVP]
"OpticTygre" <opticty***@adelphia.net> schrieb:
> When you create a new component, compile it, and add it to the toolbox, it
> comes with that boring gearbox icon next to it.  How can you change the
> icon associated with a new component you create?

Create a bitmap of size 16 × 16 and give it the name of the class ('Class
BlaBla' ->
"BlaBla.bmp").  Then you can add the bitmap to the project and set its build
action to embedded resource.  Extend your code like this:

\\\
<ToolboxBitmap(GetType(BlaBla))>
Public Class BlaBla
    .
    .
    .
End Class
///

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
31 Mar 2005 11:03 PM
OpticTygre
Ahhh, thanks.  That's exactly what I was looking for.  Just learning about
attributes, too, so this is another one that gets added to the list.


Show quoteHide quote
"Herfried K. Wagner [MVP]" <hirf-spam-me-here@gmx.at> wrote in message
news:ePxjQRkNFHA.2144@TK2MSFTNGP09.phx.gbl...
> "OpticTygre" <opticty***@adelphia.net> schrieb:
>> When you create a new component, compile it, and add it to the toolbox,
>> it comes with that boring gearbox icon next to it.  How can you change
>> the icon associated with a new component you create?
>
> Create a bitmap of size 16 × 16 and give it the name of the class ('Class
> BlaBla' ->
> "BlaBla.bmp").  Then you can add the bitmap to the project and set its
> build
> action to embedded resource.  Extend your code like this:
>
> \\\
> <ToolboxBitmap(GetType(BlaBla))>
> Public Class BlaBla
>    .
>    .
>    .
> End Class
> ///
>
> --
> M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
> V B   <URL:http://classicvb.org/petition/>
Author
1 Apr 2005 12:25 AM
Dennis
Herfried, not sure what you mean by create a bitmap and give it the name of a
Class.  I know how to create bitmaps using the image editor and add them add
them as embeded resources but don't understand how to give them the name of a
class.  Could you please explain a bit more...thanks.

Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "OpticTygre" <opticty***@adelphia.net> schrieb:
> > When you create a new component, compile it, and add it to the toolbox, it
> > comes with that boring gearbox icon next to it.  How can you change the
> > icon associated with a new component you create?
>
> Create a bitmap of size 16 × 16 and give it the name of the class ('Class
> BlaBla' ->
> "BlaBla.bmp").  Then you can add the bitmap to the project and set its build
> action to embedded resource.  Extend your code like this:
>
> \\\
> <ToolboxBitmap(GetType(BlaBla))>
> Public Class BlaBla
>     .
>     .
>     .
> End Class
> ///
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>
Author
1 Apr 2005 12:51 AM
Herfried K. Wagner [MVP]
"Dennis" <Den***@discussions.microsoft.com> schrieb:
> Herfried, not sure what you mean by create a bitmap and give it the name
> of a
> Class.  I know how to create bitmaps using the image editor and add them
> add
> them as embeded resources but don't understand how to give them the name
> of a
> class.  Could you please explain a bit more...thanks.

The name of the bitmap file must consist of the class' name with ".bmp"
appended to the end (class 'Foo', name of bitmap file "Foo.bmp").

--
M S   Herfried K. Wagner
M V P  <URL:http://dotnet.mvps.org/>
V B   <URL:http://classicvb.org/petition/>
Author
2 Apr 2005 12:29 AM
Dennis
I think I understand now.  I create a bitmap and name it Foo.bmp then add it
to my UserControl project as an embedded resource.  Then it will
automatically show up in the ToolBox opposite the UserControl Class Name if I
use the ToolBoxBitmap Attribute.

Show quoteHide quote
"Herfried K. Wagner [MVP]" wrote:

> "Dennis" <Den***@discussions.microsoft.com> schrieb:
> > Herfried, not sure what you mean by create a bitmap and give it the name
> > of a
> > Class.  I know how to create bitmaps using the image editor and add them
> > add
> > them as embeded resources but don't understand how to give them the name
> > of a
> > class.  Could you please explain a bit more...thanks.
>
> The name of the bitmap file must consist of the class' name with ".bmp"
> appended to the end (class 'Foo', name of bitmap file "Foo.bmp").
>
> --
>  M S   Herfried K. Wagner
> M V P  <URL:http://dotnet.mvps.org/>
>  V B   <URL:http://classicvb.org/petition/>
>
>