Adding an About Box

 | Assignments | Hints and Extra Credit | Outputs | Requirements |

ActiveX controls can have an About property at the top of the Properties window
as shown in the
following illustration.

Properties Window when the Active-X Control is selected after placing it on a form in new project

 

 

 

 

 

 

 

 

 

 

 

 

To add an About box to your control

1. Add an About Dialog form similar to the one listed below to the ActiveX project not the program to test it !

About Dialog displayed after clicking the build button to the right of the (About) property in the Property Window at Design Time

 

 

 

 

 

 

 

 

 

Steps: Click the Add Form Button Add Form Button  on the Visual Basic toolbar on the Visual Basic toolbar. Then double-click the About Dialog icon as highlighted in yellow in the dialog box below.

Add Form Dialog Box showing About Dialog Icon

The following dialog box will be displayed.

About Dialog Box Sample

Change the Captions of the four labels in the About Form above using code by changing the statements in the Form_Load event to explain the purpose and the properties of the newly created ActiveX control. Change the Picture property of the PictureBox control Picture Box Icon on About Dialog Box if appropriate, and also the Icon property of the About Form. Remember to change the Caption property of the form! The Project Window should now look like the following diagram.

Project Window VB6 showing About Dialog Box

 

2. Create a public procedure in the control class to display the form. Since the procedure is public the code is placed in the General section of your code window for the UserControl1 form, not your newly created About form! Double-click on the UserControl1 Icon in the above diagram to make the UserControl1 form the Active Window. Click the View Code icon View Code Icon in the Project Window, then click on General in the object drop-down list in the code window and type in the code listed in red below.

The following example code displays the About Dialog form for your ActiveX control:

Public Sub ShowAbout()

frmAbout.Show vbModal
Unload frmAbout
Set frmAbout = Nothing

End Sub

3. Assign the public procedure to the AboutBox procedure attribute of your control class. You must click the View Code icon View Code Icon in the Project Window first.

a. On the Tools menu, select Procedure Attributes. The following dialog box will be displayed.

Procedure Attributes Dialog Box

b. In the Procedure Attributes dialog box, select the procedure that displays the About box (ShowAbout), and click Advanced. The following properties will be added to the bottom portion of the dialog box listed above.

Procedure Attributes Dialog Box Advanced Properties Example

c. In the Procedure ID listbox, select AboutBox as shown in the above dialog box, and click OK Button Icon.

4. To see the for AboutBox for the Active-X control follow the steps below. You must put the Active-X control icon into a New Project first.

a. On the Properties Window, select About Property.

b. In the value area, Click the Build Button Build Button Icon and view the About box that displays

c. Click OK Button Icon when finished viewing the AboutBox.

Specifying a Toolbox Bitmap

You can specify a custom bitmap to appear in the Visual Basic Control Toolbox, as shown in the following illustration. The Bitmap Icon Button icon is a new icon used for the ActiveX control.

Bell at Bottom of Toolbox is the new Active-X Control Icon

 

 

 

 

 

Toolbox bitmaps are 16 by 15 pixels in size. If you specify a bitmap of a different size, it will be scaled to 16 by 15 pixels, which will usually distort the image.

To specify a Toolbox bitmap, set the ToolboxBitmap property of the UserControl object to the bitmap you want displayed for the control.

 | Assignments | Hints and Extra Credit | Outputs | Requirements |