Monday, October 8, 2007

CaptionX Control

This control allows you to place icons that work like command buttons in a window's title bar to the right of the standard buttons Minimize, Maximize and Close. The component also provides you with the ability to draw at the title area so you can place here formatted text or even graphics.


Image Gallery - Click Image to Enlarge
CaptionX Control

Detailed Product Description

This component supports all types of VB windows - sizable, dialog or tool windows (the BorderStyle property in VB) and takes into account the visibility of the Minimize, Maximize and What's This buttons; it can be used in MDI parent and child windows; it even supports Windows XP styled borders of windows!

Each caption icon can have its own tooltip that displays tip text and optionally title and icon; you can also adjust such common tooltips parameters as style (balloon or standard rectangular), visible and delay time.

A window's caption text can be drawn by CaptionX or by the developer (this feature is also known as custom drawing); in the last case you can draw your own formatted text using different colors and fonts or even place pictures in window caption.

CaptionX was designed specially for Visual Basic 6 forms as an ActiveX control invisible at run-time. It is based on intercepting window nonclient area messages of VB forms package and can not be used with other types of forms which support ActiveX controls (.NET Windows Forms, UserForms in VBA in MS Word and Excel and so on).

All you need to do to display your own icons with CaptionX is to link this control to an image list with the ImageList property and define caption icons using the Add method of the Icons collection. For instance, the icon under the pointer on the screenshot above was created using the following statement:

CaptionX1.Icons.Add _
ImageIndex:=1, _
Key:="mail", _
ToolTipText:="Click this icon to write a letter" & _
vbCrLf & "to 10Tec Company", _
ToolTipTitle:="Write a letter", ToolTipIcon:=ttiInfo

Each caption icon raises the following events: Click (when the user clicks an icon), MouseEnter and MouseLeave (when the mouse pointer enters and leaves the area occupied by a caption icon). CaptionX also raises the CustomDrawTitle event you can use to draw your own title text and images when you set the CustomDrawing property to True.

CaptionX event and object model allows you to implement a lot of tasks. For instance, you can display your own tips for caption icons in window status bar or highlight them when the user moves the pointer over them using the MouseEnter event. The Click event can be used to change an icon glyph; in this case the code may look like the following:

Private Sub CaptionX1_Click(ByVal IconIndex As Long)
CaptionX1.Icons("mail").ImageIndex = ImgList.ItemIndex("open_mail")
End Sub

You can also change caption icon tooltips dynamically, set a window's caption text periodically by timer events and so forth.


No comments: