VXPLib Code Samples

Code Samples for Microsoft Visual Basic 6


All code examples presented here were originally designed to run under Microsoft Visual Basic 6, and it can be quite difficult to convert them into VB.NET.
Therefore, we offer you to download all these examples for VB.NET separately from www.tooltips.net
SamplePurpose
TooltipMonitor Shows usage of tooltips in the VB environment;
Allows to experiment with all settings for the Tooltip object and TooltipManager to choose the one that will best suit your applications.
AreaTooltip Shows how to attach a tooltip to any part of a visual element, such as part of a window. In this example we draw a cross in the middle of a picture box to have four quarters in it, and then attach a separate tooltip to each quarter.
Speech Illustrates usage of the Microsoft Speech platform via the Tooltip object of the VXPLib component.
The examples shows how tooltips can read their own text (and not only) using any speech SDK. In this example we are using Microsoft Speech SDK just as an example. You also can see how speech contents can be used along with contents of tooltips seamlessly within the same QHTML contents to provide finer speech quality, and how sound effects can be synchronized with the tooltip object.
Note: To run this example you will need Microsoft Speech SDK 5.1 installed on your PC, or at least its redistributable part.
Document See how the Quick HTML parser can work with virtual documents. By using virtual documents we can draw dynamically right inside QHTML documents! This example draws a simple document inside contents of a tooltip.
Drawing Lessons: Three steps of explaining how to draw QHTML contents on a VB form:
Drawing Lesson 1 The simplest possible example of drawing QHTML on a VB form.
Drawing Lesson 2 Drawing a complex QHTML contents in the middle of a VB form using transparent output.
Drawing Lesson 3 Drawing an image on a VB form with switched ON/OFF transparency, and in one of the following three ways:
  • Simple
  • Tiled
  • Stretched
Menu Examples: A few examples of how to use VXPLib to create XP-Style menus in Visual Basic
Note: Because these examples work with resources you cannot run them from the VB6 environment but only via EXE files.
XP Menus
An introductory example that does the following:
  • Overrides menus to be ownerdrawn, then measures and draws those menu items
  • Attaches a tooltip to each overridden item
  • Uses usual and XP style for selecting menu items
  • Shows how to set a custom color for menu background and item selection
  • Uses program resources to store HTML contents for drawing menu items
  • Updating layout of menus when visual settings change in the system
  • Shows how to handle the event of selecting a menu item, and draw contents of the item on a form.
Advanced Menus
This example emphasizes on drawing custom separators using Quick HTML. It draws a regular type of separators, plus menu caption and footer, totally:
  • Overrides menus to be ownerdrawn, then measures and draws those menu items
  • Uses XP style for selecting menu items
  • Uses program resources to store HTML contents for drawing menu items
  • Draws custom menu separators using tag <HR>
  • Draws menu caption and footer as overridden menu separators
  • Overrides a menu item on the menu bar, and draws it using XP selection.
Context Menus
This example illustrates overriding a context menu by using interfaces IVXPMenuHook and IVXPQuickHTML. Interface IVXPTooltipManager is used for attaching a tooltip to the "Tip of the day" item, and the main form.
Totally, the example does the following:
  • Overrides items of a context menu to be ownerdrawn, then measures and draws those menu items
  • Uses XP style for selecting menu items
  • Uses program resources to store HTML contents for drawing menu items
  • Draws a "Tip of the day" item using a special background for unselected state, and special color for selected state. This is to show that menu items can be selected using different colors.
  • Attaches a tooltip to the main form and the "Tip of the day" item.

This document was last updated on 07/02/2003