To add designer-specific items to the host's toolbox, you must specify the DesignerToolbox key in the registry. This key identifies the name and location of the resources for each toolbox item. The host uses this information in adding the designer's items to the toolbox after creating an instance of the designer. See Chapter 11, "Registry Reference," for details on the format of the registry entry.
You describe the toolbox items in a resource (.rc) file, which is built into the designer's dynamic-link library (DLL). Each toolbox item has a resource ID that is associated with two resources: a string resource and a bitmap resource. The string resource contains the text used as the label for the toolbox item, for example, "FirstItem". The bitmap resource defines the image displayed in the toolbox. Each bitmap is 16x16 pixels, and its lower left pixel defines the transparent color of the bitmap.
In the .rc file, specify only the normal (enabled and not selected) version of the bitmap. The host generates the Disabled and Selected versions.
The following example shows the resource definition for a designer that contributes three items to the host's toolbox:
//MyDesigner.rc
1001 BITMAP “one.bmp”
1002 BITMAP “two.bmp”
1003 BITMAP “three.bmp”
STRINGTABLE
BEGIN
1000, "MyDesigner Tools"
1001, "FirstItem"
1002, "SecondItem"
1003, "ThirdItem"
END
In the example, the resource IDs for the toolbox items are 1001, 1002, and 1003. The bitmap resources are stored in the files one.bmp, two.bmp, and three.bmp, and their associated string resources are "FirstItem", "SecondItem", and "ThirdItem". The following \DesignerToolbox entry describes these toolbox items:
\DesignerToolbox
NameId 1000
ResourcePath MyDesigner.DLL
ItemStartId 1001
ItemCount 3
The resource ID that corresponds to NameId specifies a string resource that names the set of toolbox items; the host can display this string in its toolbox palette.
You can register the toolbox entries for a designer as part of the DllRegisterDesigner routine.