Sometimes, just sometimes, the toolbox bitmap for windows forms control can be a complete pain, especially I've noticed in VB controls. This is often true if your control needs to reside in a particular namespace.
The toolbox bitmap attribute accepts as its parameters the type of a control in the assembly from which the toolbox bitmap is to be drawn and the name of the resource which holds the toolbox bitmap. Often however, the fully qualified name of the control which includes the namespace can confuse the compiler which results in it being very difficult to find the toolbox bitmap and it seems no matter how hard you try your control is always endowed with a little gear wheel and not your carefully prepared icon.
A little trick, which I will pass on to you, is to create in your assembly a class with internal access, which I often call resfinder, which is created outside of any namespace declarations. Then, however your name spaces are arranged internally, you will always be unable to find the toolbox bitmaps in your assembly by providing the type of resfinder instead of the type of the control that you wish to provide a toolbox bitmap for.
I must remember to put this in the tips and tricks.
No comments:
Post a Comment