Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm Controls / March 2008

Tip: Looking for answers? Try searching our database.

How to change default image in a custom control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Seth Williams - 07 Mar 2008 19:36 GMT
When a custom control is compiled, and then added to the VS.Net toolbox, it
has a 'gear' type image.

For the life of me, I've searched on the net over and over and can't find
how to change that image, inside the control itself, when you're building
it.

Has anyone got a vb.net tutorial/website page/whatever, which tells how this
is accomplished?
Bob Powell [MVP] - 07 Mar 2008 20:31 GMT
Put an image in the resources, compile it as an embedded resource.

Then use the ToolboxBitmap attribute to specify the image.

Signature

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

> When a custom control is compiled, and then added to the VS.Net toolbox,
> it has a 'gear' type image.
[quoted text clipped - 5 lines]
> Has anyone got a vb.net tutorial/website page/whatever, which tells how
> this is accomplished?
Seth Williams - 12 Mar 2008 02:16 GMT
I added my control to the resources, added the toolboxBitMap attribute:

<System.Drawing.ToolboxBitmap("C:\MyPath\Resources\MyBitmap.bmp")> _   '
<---- it only seems to accept a full path
lic Class MyClass
Nothing - after installing, I just got the default bitmap

and compiled, then installe
> Put an image in the resources, compile it as an embedded resource.
>
[quoted text clipped - 9 lines]
>> Has anyone got a vb.net tutorial/website page/whatever, which tells how
>> this is accomplished?
Bob Powell [MVP] - 14 Mar 2008 09:28 GMT
See Windows Forms Tips and Tricks for how to decipher that annoying
reference string (for the classic approach)

The .Net 2.0 resource system however is much easier to use. What are you
using?

Signature

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.

>I added my control to the resources, added the toolboxBitMap attribute:
>
[quoted text clipped - 17 lines]
>>> Has anyone got a vb.net tutorial/website page/whatever, which tells how
>>> this is accomplished?
Seth Williams - 17 Mar 2008 15:09 GMT
Definitely using v2.0 - and, for the normal things - I'm fairly used to
it - - just don't fully get it -
I came across your page before, and even after reading it, I'm not 100%
sure - - just to recap
My bitmap is called: MyBitmap.bmp  (added to both the project Resources and
the root of the Solution, though I'm not sure I need both - just grabbing at
straws at this point)
My DLL is called: MyControl.DLL
the Namespace is: MyCompany.Controls.MyControl

So, if I used your top syntax, if I understand it correctly, I would think I
would use:
ToolboxBitmap(typeof(MyControl),"MyCompany.Controls.MyControl.MyBitmap.bmp")

Am I on the right track here?

> See Windows Forms Tips and Tricks for how to decipher that annoying
> reference string (for the classic approach)
[quoted text clipped - 23 lines]
>>>> Has anyone got a vb.net tutorial/website page/whatever, which tells how
>>>> this is accomplished?

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.