Defining a Tool Icon

To make a tool available from your tool palette's tray, you provide a bitmap to serve as its icon. The AcadToolImpl class uses the image name argument passed to its template constructor to associate the bitmap with your tool. Your image name argument's value must match the ID property of your bitmap resource. Also, you must type double quotes around this resource ID in your bitmap resource's property list. If you forget the quotes, Visual Studio assigns an integer value to the resource ID. This prevents the bitmap from appearing on your palette.

Note: If you previously built your project without the double-quote delimiters around the bitmap resource's ID property, remove the ID's integer assignment in your resource.h file.

To define a tool icon

  1. In Visual Studio's resource editor, create a new bitmap resource. You may either draw it or import it. Make sure that it is drawn on a 64 x 64 canvas.
  2. Browse the bitmap's properties, and change its ID property to “IDB_TOOL1”. Be sure to type double quotes before and after this name.
  3. Rebuild your project.

Because we passed the bitmap resource name, IDB_TOOL1, as the final argument of the AcadToolImpl template constructor, the framework uses this resource as the icon for dynamically created tools. You can also override this bitmap setting when you create tools within your code. This override is discussed in the section Creating an AutoCAD Command.