Back to Home
Visual Graph Home
TriSun Software Inc. Home

Visual Graph Site Menu
What is Visual Graph?
50 Technical Features
Getting Started
Abundant Graphic Libraries
File Format
Online Demo (IE Only)
Common Applications
Visual Graph Getting Started
Use VG Component in Delphi 6
Use VG Component in VB6
Use Graphic Library
Change Element's Shape
Customize Property
Make Graphic Button
Get the Selected Elements
Dynamically Create Graph
Movable Label
Link Point
Access Properties
Use Line Vertexes
Call Windows API Functions
Call Visual Graph Functions
Callback Control Event in Script
Drag Graph in Run Mode
Detail Report
Make and Use Dialog Box

Visual Graph Getting Started - Get the Selected Elements

We usually need to get the selected elements in a graph, here is an example in VB6:

1. Create a new project in VB6, right-click on Toolbox and select Components, and then check Visual Graph ActiveX Control and click <OK>.

2. Click vgctrl in Toolbox, and then draw an instance on Form1, this control will be used to draw.

3. Write the following code in Form_Load event:

Dim d As Object
vgctrl1.Design ""
Set d =, "circle")
d.SetBounds 10, 10, 40, 40
Set d =, "circle")
d.SetBounds 60, 10, 40, 40
Set d =, "circle")
d.SetBounds 110, 10, 40, 40

4. Write the following code in vgctrl1_OnSelectChange event:

Dim g As vgCtl.IGroup
Dim s As String
Set g =
s = "You have selected " & g.UnitCount & " elements."
If g.UnitCount > 0 Then
   s = s & " The first selected element is: " & g.Units(0).Name & "."
End If
Me.Caption = s

5. Run this project, select two circles in Visual Graph Control. The running interface might look like this:

Get Selected Elements

Sitemap | Legal Notices | Privacy Policy | Contact Us | About Us
Copyright© 2001-2024 TriSun Software Inc. All rights reserved.