The information in this article applies to:
SUMMARY
The Microsoft Visual Basic VBX custom control architecture does not provide
a mechanism for creating custom methods. Custom properties and custom
events are supported, but only a set of eight predefined methods can be
used by VBX custom controls. MORE INFORMATIONTechnique One: Implement a Custom Action PropertyThe most common way to simulate a custom method is to implement a custom action property. For example, assume that the control needs a custom line method. You could set up an action property that draws a line when the property is set.Below is a hypothetical code example:
When the custom control receives a message that the Action property is
being set, it can use the information in the StartX, StartY, EndX, and EndY
properties to draw a line.This technique is very popular and is used in several of the custom controls that ship with the Professional Edition of Visual Basic version 3.0. Technique Two: Use an Exported FunctionAs an alternative, you can use an exported function within the VBX itself. For example, add the following code to the Visual Basic program:
Add the following to the VBX code:
This technique is also used in some Professional Edition controls (for
example, the MSComm control). This technique allows you to pass more than
one parameter to your control, but it also requires slightly more code on
the part of the Visual Basic programmer.
Additional query words: 3.00 4.00 vb416 vb4win
Keywords : kbcode TlsCDK |
Last Reviewed: September 17, 1999 © 2000 Microsoft Corporation. All rights reserved. Terms of Use. |