Windows Develop Bookmark and Share   
 index > Windows Forms Designer > ToolBox does not display ToolBoxBitMap image
 

ToolBox does not display ToolBoxBitMap image

Hello all,

I have placed the following on my class:

<ToolboxBitmap(GetType(MyClass), "Images.ToolBoxMyClass.bmp")> _
Public Class MyClass
    Inherits Control

It is installed here:
C:\Program Files\Path\MyClass

and the bitmap is installed here:
C:\Program Files\Path\MyClass\Images

But when I add it to the Visaul Studio ToolBox it does not display. Thanks in advance for any ideas and/or suggestions!
j2associates  Wednesday, October 07, 2009 9:51 AM
Here are 3 examples from http://msdn.microsoft.com/en-us/library/4wk1wc0a(VS.71).aspx

I think you're trying to use the last one. What's your Image Resource Name?

I think this resource name Images.ToolBoxMyClass.bmp is wrong. Could you check.

Also if your image is in a folder you can directly give path to control as sample 2

// C#
// Specifies the bitmap associated with the Button type.
[ToolboxBitmap(typeof(Button))]
class MyControl1 : UserControl
{
}
// Specifies a bitmap file.
[ToolboxBitmap(@"C:\Documents and Settings\Joe\MyPics\myImage.bmp")]
class MyControl2 : UserControl
{
}
// Specifies a type that indicates the assembly to search, and the name
// of an image resource to look for.
[ToolboxBitmap(typeof(MyControl), "MyControlBitmap")]
class MyControl : UserControl
{
}
Tamer Oz  Wednesday, October 07, 2009 11:09 AM
Hi j2associates,

Welcome to MSDN again.

On this thread (http://social.msdn.microsoft.com/Forums/en-US/winformsdatacontrols/thread/dd68efc6-246b-4eae-80b0-4ae97f32ff29)
I have given you the link to a KB article (http://support.microsoft.com/kb/311315)

In that KB, you can see the “Deploy the Control and the Image File as Separate Files” paragraph.
<ToolboxBitmap("c:\MyIcon.bmp")> _
   Public Class MyUserControl
      Inherits System.Windows.Forms.UserControl

      ' Generate code.
      ' Code for the control.
   End Class
It uses the absolute path of the bmp file.

So in your situation, please try to use “<ToolboxBitmap(GetType(MyClass), "C:\Program Files\Path\MyClass\Images\ToolBoxMyClass.bmp ")> _”.

If you have any problems, please feel free to tell me.

Sincerely,
Kira Qian
Send us any feedback you have about the help from MSFT at fbmsdn[At]microsoft.com
Please remember to mark the replies as answers if they help and unmark them if they provide no help.
Welcome to the All-In-One Code Framework!
Kira Qian  21 hours 29 minutes ago

You can use google to search for other answers

Custom Search

More Threads

• Custom toolbar control in .Net framework
• DataGridView declared local, not private?
• Let the user add components
• Gah! The designer is filling in my properties for me!!
• Right-click context menu (copy/paste) doesn't work on MDIChildForms...
• VS 2005 crashes when opening derived Form in different Assembly
• passing additional information to the Custom CollectionEditor
• ContainerControl inside another ContainerControl
• Nested InstanceDescriptors (short)
• My userControl is Blinking... :-(