473,385 Members | 2,210 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Icon for Components

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
7 1047
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
"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
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
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
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
"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
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Dave | last post by:
Hi I am trying to set my windows xp pro system up so that i can write and test ..asp pages.I have followed the instructions given by www.w3schools.com to install the internet information...
10
by: Zeljko | last post by:
Hi, I have a form with a tray icon. However, when I minimize the form, it stays visible - not in the task bar (I have showintaskbar property set to false), but in a form of a rectangle sitting...
3
by: Andrew Mueller | last post by:
Hello, I have a C# service that I would like an icon to show in the system tray upon startup. I put a NotifyIcon on the form and changed the properties as follows: Name: ni...
4
by: utkarsh | last post by:
Hi, I want to develop a Window Service in C# that should be capable of sisplaying the a icon in the window tray. Based on some logic in service, icon should be changed to some other...
2
by: Mamatha | last post by:
Hi I want to add an icon to the textbox's text. I don't know how to display icon in textbox in VB.NET. If any one knows please let me know. Thanks in advance. Mamatha
4
by: techspirit | last post by:
Hi all, 1) I found out from the vb.net group that it is possible to get an associated icon for a file. My requirement is to display all programs from the Start Menu for the user along with the...
1
by: hansolox1 | last post by:
The following program simply sets the icon of a form called form1. When I get the name of the embedded icon using GetManifestResourceNames(), I store the name in a string variable called s. The...
7
by: iwdu15 | last post by:
hi, im attempting to get an applications Icon by using the method Icon.FromHandle() and passing in a windows handle, yet nothing works ive tried two different things and neither work. Ive been...
7
by: Brian | last post by:
hello Gentlemen, been trying to get a shell program working where I have a Windows service that also has a Notification icon in the system tray..... I got this idea from microsofts Visual...
11
by: prpradip | last post by:
I have an ImageList (_imageList). In _imageList I have put large numbers of Icons. Now what I need is to get Handle of all Icons that I put in _imageList, so that I can destroy (DestoryIcon) them...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.