To display a caption in an extended window, you simply enter that caption as part of the HDisplayBmp command. For embedded windows, you can display either of the following types of captions:
A caption that appears immediately above or below the window
A caption that appears when the user clicks the picture in the window
In their simplest forms, commands for inserting captions look like this:
[caption = "caption"]
[pcaption = "caption"]
The [caption] command displays an embedded caption, while the [pcaption] command displays a popup caption. An embedded caption is similar to the words “State Bird Cactus Wren” in the following illustration:
Viewer displays popup captions when the user clicks the bitmap. The following illustration contains an example of a popup caption.
The caption commands give you even more control over the appearance of captions. You can specify the position of the caption, its foreground and background colors, and any line breaks within the caption as part of the caption commands.
Note:
Caption text must use the default Word for Windows font. You cannot use different fonts, font sizes, or text attributes (like italic or bold) for caption text.
To tell Viewer where in the bitmap to display the caption, add the following options to the caption command:
[caption = "\phoriz:vert caption"]
[pcaption = "\phoriz:vert caption"]
In these commands, horiz specifies the horizontal position: c for center, l for left, or r for right; vert specifies the vertical position: t for top or b for bottom.
To specify foreground and background colors for the caption, add the following options to the caption:
[caption = "\cfred;green;blue\cbred;green;blue caption"] [pcaption = "\cfred;green;blue\cbred;green;blue caption"]
The values following the \cf option are the RGB values for the foreground color, separated by semicolons. The values following the \cb option are the RGB values for the background color.
Hint:
Use the Colors application from the Windows Control Panel to see the colors resulting from different RGB values. Choose the Colors button in the application, then choose the Define Custom Colors button at the bottom of the palette.
If you use the \cf and \cb options, they must appear after the position option but before the actual caption.
To specify line breaks in the caption text, enter a \l code at the point you want to insert the line break.
The following ewc command inserts a caption above the embedded bitmap TX_TREE.BMP that illustrates the different caption-authoring features in this section:
{ewc MVBMP, ViewerBmp, [caption=";t;0;0;192;192 Pecan" ]tx_tree.bmp}
The caption is centered at the top of the window (\pc;t). The caption uses black text (\cf0;0;0) on a light-gray background (\cb192;192;192). A line break (\l) appears between the words “Pecan” and “Tree.” The caption appears in the title as follows: