L_LTANN_API L_INT L_AnnSetAutoHilightPen(hAutomation, crHilight)
Sets the color of the pen that is used for highlighting.
Handle to the annotation automation object. Pass NULL to change the default, which affects newly created automation objects.
A COLORREF value representing the color of the pen used for highlighting.
|SUCCESS||The function was successful.|
|< 1||An error occurred. Refer to Return Codes.|
Use this function to change the color of the pen that is used for highlighting and selecting. More specifically, this pen is used in the following situations:
In automated annotation design mode, after selecting ANY tool and clicking and dragging the mouse to draw an outline. The resulting outline is displayed using the highlight pen.
In automated annotation design mode, after choosing the Select tool and clicking on an existing annotation object. While the left mouse button is held down, the selected object is displayed using the highlight pen.
The highlighting is implemented by taking the "exclusive-or" (XOR) of the highlight pen color and the underlying image pixels.
The default highlight pen has a COLORREF value of 0xFFFFFF (white). This color works well for most images. However, images that have many mid-range gray colors will not effectively show a highlight. To understand why this is so, consider an image that contains only the color gray 0x808080. The highlight color will be determined as follows:
Highlight Color = (0xFFFFFF) XOR (0x808080)
The highlight color (0x7F7F7F) (gray) and the underlying image color (0x808080) (gray) are almost the same color, and nearly indistinguishable to the naked eye. In cases like this, the highlight will not be visible.
To avoid this, choose a different highlight pen color so that the XOR operation with the underlying color will give a result that is visibly different from the underlying color.
A good choice is 0xC0C0C0 (silver). Using this color the highlight color will be determined as follows:
Highlight Color = (0xC0C0C0) XOR (0x808080)
The resulting highlight color (0x404040) is another gray, but is more visible and stands out much more clearly against the underlying image color (0x808080), allowing for easy differentiation between the two.
Note that several of the automated mode annotation cursors are displayed using an XOR operation. These cursors will not be visible if an image has many mid-range values. To avoid this, define new cursors and use the L_AnnSetAutoCursor function. The main annotation demo (ANNOT32.EXE) demonstrates how to change the highlight pen and the annotation cursors.
Each automation object can have its own highlight pen color. To change the default highlight pen for newly created automation objects, pass NULL for the
hAutomation parameter. The only way to restore the default color is to call L_AnnSetAutoHilightPen and set the color back to the original value (0xFFFFFF).
Required DLLs and Libraries
This sample changes the annotation highlight pen for the existing automation object, and for all automation objects that will be created.
L_INT AnnSetAutoHilightPenExample(HANNOBJECT hAutomation)
// Change the highlight pen for the existing automation object
nRet = L_AnnSetAutoHilightPen(hAutomation, RGB(0xC0, 0xC0, 0xC0));
if(nRet != SUCCESS)
// Change the default highlight pen--all newly created automation objects will have this for the default highlight pen
nRet = L_AnnSetAutoHilightPen(NULL, RGB(0xC0, 0xC0, 0xC0));
if(nRet != SUCCESS)
Medical Web Viewer .NET
.NET, Java, Android, and iOS/macOS Assemblies
C API/C++ Class Libraries