Tip If you prefer working from a printed tutorial, see Copying and Printing in MSDN Library Help for details about printing a lesson, a set of topics, or a single topic.
The ActiveX control classes support a property type that can be accessed only through a Get/Set method pair. By wrapping Get and Set methods around the property, you can shield the user from the internal representation and implementation of the property.
Note You can find a finished example of this lesson's code in the CIRC2 sample source code directory.
Forcing access to a property through methods can be beneficial. For example, a Set method can be coded to validate an input value before the property's value is set to it, or a property can represent a computed value. When the computed property is accessed, its Get method performs a computation and returns the result as the property value.
In this lesson, you will implement a Get/Set property, CircleOffset, for the Circle control. The CircleOffset property allows the circle to be offset from the center of the control's bounding rectangle. Before the offset is modified, the Set method makes sure that the edge of the circle will stay within the control's bounding rectangle. In C++, Get and Set methods are implemented as member functions.
In this lesson, you will: