Back to Home
Visual Graph Home
TriSun Software Inc. Home

Visual Graph Site Menu
Home
What is Visual Graph?
Screenshots
50 Technical Features
Getting Started
Abundant Graphic Libraries
File Format
FAQ
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 - Call Visual Graph Functions

Now we explain how to call Visual Graph functions through a VB6 example.

1. Create a new file in Visual Graph IDE, click Program -> Add function menu item and fill the opened dialog box as below:

Call Visual Graph Functions 1

Please note that the function Type must be set as Public to let other programming languages to access it.

2. Paste the following code to AddCircles function:

i = 0
while i < Col
j = 0
while j < Row
d = AddUnit( 0, "circle" )
d.SetBounds( 10 * i, 10 * j, 10, 10 )
j = j + 1
wend
i = i + 1
wend
return UnitCount


3. Save current file as h:\test.tbl

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

5. Click vgctrl in Toolbox, and then draw an instance on Form1.

6. Double-click Form1 and write the following code in Form_Load event:

Dim col, row, n As Integer
vgctrl1.Design "h:\test.tbl"
col = 10
row = 5
n = vgctrl1.vg.ActiveSheet.Execute("return AddCircles( " & CStr(col) & "," + CStr(row) & " )") MsgBox CStr(n)


7. Run this project, you will get a message box with 50 prompt, indicates there are 50 circles generated.

8. If you do not need the return value or this function has not return value, just call AddCircles function like this:

vgctrl1.vg.ActiveSheet.Execute "AddCircles( " & cstr( col ) & ", " + CStr( row ) + " )"

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