Megosztás a következőn keresztül:


Visual Basic Concepts

Building ActiveX Controls

This chapter covers control creation in depth. The majority of the topics are organized according to the sequence of control development tasks outlined in "Control Creation Recap," at the end of the topic, "Creating an ActiveX Control."

First and most important, however, is an introduction to the terminology and concepts of control creation, in the topics "Control Creation Terminology," "Control Creation Basics," and "Interacting with the Container."

These are followed by topics associated with development tasks:

  1. Determine the features your control will provide.

    "Visual Basic ActiveX Control Features."

  2. Design the appearance of your control.

    "Drawing Your Control."

  3. Design the interface for your control — that is, the properties, methods, and events your control will expose.

    "Adding Properties to Controls," "Adding Methods to Controls," "Raising Events from Controls," and "Providing Named Constants for Your Control."

  4. Create a project group consisting of your control project and a test project.

    "Setting Up a New Control Project and Test Project."

  5. Implement the appearance of your control by adding controls and/or code to the UserControl object.

  6. Implement the interface and features of your control.

    "Creating Robust Controls."

  7. As you add each interface element or feature, add features to your test project to exercise the new functionality.

    "Debugging Controls."

  8. Design and implement property pages for your control.

    This subject is covered in "Creating Property Pages for ActiveX Controls."

  9. Compile your control component (.ocx file) and test it with all potential target applications.

    "Distributing Controls."

The chapter ends with "Localizing Controls," which discusses localizing your control for other languages. The complete list of top-level topics is:

Topics

Control Creation Terminology

Briefly introduces terms that make discussions of control creation simpler, and draws some important distinctions between terms commonly used in other contexts.

Control Creation Basics

Introduces the UserControl object, the three ways to build controls, the two ways to package them, and key events in the lifetime of UserControl objects.

Interacting with the Container

Your control is never alone. This topic examines the container your control is placed on, and some important aspects of your control's relationship to it.

Visual Basic ActiveX Control Features

Explores the features of the UserControl object that allow you to write full-featured ActiveX controls.

Drawing Your Control

Discusses user-drawn controls and controls whose appearance is provided by constituent controls placed on the UserControl.

Adding Properties to Controls

Discusses the significant differences between adding properties to controls and adding them to other kinds of objects, including saving and retrieving property values.

Adding Methods to Controls

A short discussion of control methods.

Raising Events from Controls

Explains the creation of events, and techniques for taking advantage of UserControl events and constituent control events.

Providing Named Constants for Your Control

Specifics of adding named constants to controls.

Setting Up a New Control Project and Test Project

Discusses requirements for testing and debugging ActiveX control projects.

Creating Robust Controls

Lists and briefly explains some DOs and DON'Ts.

Debugging Controls

Discusses the finer points of running and debugging code at design time.

Distributing Controls

In addition to the obligatory discussion of Setup programs, this topic explains licensing and versioning issues for controls.

Localizing Controls

Outlines development strategies for creating controls that can be marketed in many language locales.

Sample application

CtlPlus.vbg

Includes a fully functional version of the ShapeLabel control created in the step-by-step procedures in "Creating an ActiveX Control," and other controls that illustrate the control creation features in this chapter. The sample applications are listed in the directory.