DG Kernel Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
Overview of the software
What is new
Licensing
Collapse ModelsModels
Collapse DG Kernel ComponentsDG Kernel Components
Collapse API ReferenceAPI Reference
Interface List
Vector Space
Collapse General GeometryGeneral Geometry
Collapse ModelModel
Collapse ViewView
Collapse General ComputingGeneral Computing
Collapse Samples and TutorialsSamples and Tutorials
Collapse GraphicsGraphics
Collapse Math ObjectsMath Objects
Collapse DeprecatedDeprecated
Redistribution
Model Viewer
Open Source
Support
Skip Navigation Links Search Documentation


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 SamplesAll samples.