By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,032 Members | 1,161 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,032 IT Pros & Developers. It's quick & easy.

Icon for Components

P: n/a
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?
Nov 21 '05 #1
Share this Question
Share on Google+
7 Replies


P: n/a
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
Nov 21 '05 #2

P: n/a
"OpticTygre" <op********@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
Nov 21 '05 #3

P: n/a
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?
"Crouchie1998" <cr**********@discussions.microsoft.com> wrote in message
news:OX*************@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

Nov 21 '05 #4

P: n/a
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.
"Herfried K. Wagner [MVP]" <hi***************@gmx.at> wrote in message
news:eP**************@TK2MSFTNGP09.phx.gbl...
"OpticTygre" <op********@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/>

Nov 21 '05 #5

P: n/a
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.

"Herfried K. Wagner [MVP]" wrote:
"OpticTygre" <op********@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/>

Nov 21 '05 #6

P: n/a
"Dennis" <De****@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/>

Nov 21 '05 #7

P: n/a
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.

"Herfried K. Wagner [MVP]" wrote:
"Dennis" <De****@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/>

Nov 21 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.