Sie sind auf Seite 1von 4

Software Technical Note

Title: SmartSketch Macro Icons, Tooltips, and Helpstrings

Abstract: How to add button faces, tool tips and help strings to a SmartSketch
Macro command.

Document Information:
Number: STN_SS_012
Product: SmartSketch
Version: All
Platform: Win32
Discipline: Customization
Level/Type: Beginner/Informational
Prepared By: Stan Thornton
History: 25 March 1998 – Original
20 October 2001 – Updated
26 June 2009 - Updated

Technical Information

Adding a Bitmap for use as a button face

SmartSketch macros can easily have your own bitmaps assigned to them instead of prompting
the user to select a button face at the time of adding it to the toolbar. To accomplish this you
will need to create a bitmap image, or images, to use as the button face.

Small button face bitmaps should be 16 wide x 15 high, large button face bitmaps should be 23
wide x 21 high. SmartSketch supports having both small and large as well as color and
monochrome bitmaps (for a total of 4 possible button face bitmaps) per command. This allows
your custom command button faces to react to user settings for toolbar icon display and be
consistent with the button faces for the built in commands. SmartSketch automatically
performs the switching of the button faces, based on the user settings, provided the bitmaps
that represent the button faces are present in the compiled command. SmartSketch recognizes
the magenta color as representing a transparent color for your button faces, so any area of
your bitmap that should display the standard button face background should be colored with
magenta (see the example bitmaps below).

Once you’ve created the bitmaps, you need to compile them into a resource file and add it to
your VB project. A text file is used to pass the parameters needed to the resource compiler

Page 1 of 4
(RC.EXE - typically located in the <VisualBasicRoot>\Tools\Resource directory). Create a text file
and enter a single line containing the ProgID, Resource Type, Memory Attribute, Full Path and
Filename.

Here’s an example line:

Project1.Class1 BITMAP DISCARDABLE C:\Temp\MyBMP.bmp

Save the file as FileName.RC, then drag and drop it on top of RC.EXE to create the .RES file.

Add the RES file to your Visual Basic project (Project, Add File...). When you recompile your
project the bitmap will automatically be used by SmartSketch when assigning the button face.

Visual Basic 6 now includes a Resource Editor Add-In that eliminates the need to manually
create a .RC file, compile it and add the resulting RES file to your VB project. Using the Resource
Editor, simply click the Add Bitmap resource button, browse to the location of and select the
BMP file and click OK. When the bitmap is added to the resource file, it will have an ID number
assigned to it. You must modify this ID number to be the ProgID of your command by right
clicking, selecting properties and modifying the ID. In order to have the resource editor
recognize the full ProgID of your command, you must enclose it in double quotes, i.e.;
“Project1.Class1”, and save the resource file.

Page 2 of 4
To add multiple bitmaps that represent the small color, small monochrome, large color and
large monochrome button faces, append to the ProgID of the bitmap id the letters SC for small
color, SM for small monochrome, LC for large color and LM for large monochrome.

For example, to add multiple bitmaps via the text file compiled into a resource file, the text
entries would look like the following:

Project1.Class1SC BITMAP DISCARDABLE C:\Temp\MySmallColor.bmp


Project1.Class1SM BITMAP DISCARDABLE C:\Temp\MySmallMono.bmp
Project1.Class1LC BITMAP DISCARDABLE C:\Temp\MyLargeColor.bmp
Project1.Class1LM BITMAP DISCARDABLE C:\Temp\MyLargeMono.bmp

Within the Visual Basic Resource Editor Add-in, multiple bitmaps would look like:

Adding a ToolTip and Helpstring

In SmartSketch a ToolTip is displayed beside the mouse pointer and a Helpstring is displayed in
the status bar when the mouse pointer pauses over a button. This information is obtained from
the class description of your macro. To have your own tool tip and helpstring displayed, simply
invoke the Visual Basic Object Browser, select your project from the Project/Libraries List, your
class name from the Available Classes list, right mouse click and select properties from the pop-

Page 3 of 4
up menu. This displays the Member Options dialog box. In the description field, enter the
desired helpstring and tool tip separated by "\n".

If you are also supplying a help file with a topic for this command, you should enter the Help
Context ID in the field provided on the Member Options dialog also. Enter the Help file name on
the Project Properties screen.

Page 4 of 4

Das könnte Ihnen auch gefallen