DG Kernel (ActiveX) Documentation


Skip Navigation Links.
Start page
Quick Start
Search Page
Installation
What is new
Upgrading Native Apps
Licensing
Collapse ModelsModels
Collapse DG Kernel ControlsDG Kernel Controls
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 Go to DGKC docs Search Documentation


Pick C# Sample

Pick is a Windows Form application, implemented as a Microsoft Visual Studio project which displays Light.mdg model. It demonstrates programming and handling selection of  objects in 3D view by the end user.

Overview

Running the application 

The DG Kernel Component can run in two modes: View and Modify. In View mode the control works as normal rendering the model in 3D with rotation, zoom and pan. When "Select" option is on, mouse movements are blocked and mouse clicks are processed for selection of 3D objects in the view. Name of the selected object is displayed on the form..

Implementation

On load of the form the default (View) mode of the component is changed to Modify in OnLoad method by using IViewModal interface obtained via IView interface.

OnCurrentObjectChanged handler of the CurrentObjectChanged event obtains ISection interface of the selected object by converting the parameter supplied in the handler, obtains name of the object using ISection.GetName and displays it on the form.

Notice the RequestClientDraw call, which enables ClientDraw event. This allows the cross-hair to be drawn in the OnClientDraw handler.

See also IPick, ILookEx, IItem, Visual Basic SamplesAll samples.

Things to try

- Try to implement loading of a different model.

- Try to obtain color and/or location of the selected objects and display it on the form