Label Visual Basic 6 Sample
Source code for Label sample is available in Samples\VB 
folder of the installation directory. Label is an application, implemented in Visual Basic 6.0 which 
displays Light.mdg model. It demonstrates programming of  3D Labels 
Running the application 
On start the application adds new child 3D Labels
to each object in the Light.mdg model to display the object name. 
"New Label" group adds a new top level label at a specified
location. All top level labels are listed in the provided list box.  
Modify button displays properties of the selected label from the list
box.  
Font group on Label Properties form allows changing size, face and color of
the font. The "Color" text on the form has the current color of the
label.  
Implementation
Child labels for each object are added in AddObjectLabel Sub called from the Form_Load().
IArray2
 containing all labels attached to an object is acquired from the relevant ISection
 as "Items" property via IPropertyArray2.
To add a new label InsertNew method of IArray2
 is called with the type parameter set to eItemTypeLabel member of the EItemType
enumeration.  
An individual label is controlled via IText
 obtained from the object in the IArray2. Name of
the label is modified in SetLabelName using IItem
 queried from IText
 .  
In the same way IArray2
 of the top level objects is acquired from IModel
 in the GetItemsArray Sub.  
Position of the added label is set using ILocation
 queried from IText. 
Attributes of the font of the selected label are modified in LabelPropsForm
form with the help of  IDIFont
 interface. 
See also IText, ILocation, IItem,
IDIFont
 , Visual Basic Samples, All samples. 
                 |