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 - Customize Property

Now, we explain how to customize the properties for an element through design a knife component.

We customize a property - OnOff for the knife that used in the power industry: if OnOff = False, the knife looks like the left picture, else if OnOff = True, it looks like the right picture:

Customize Property 1                  Customize Property 2

Now, explain how to do it.

1. Draw 2 circles and 4 lines like this:

Customize Property 3

Please name the lines as Line1, Line3, Line2 and Line4 according to above numbers.

2. Select current sheet by click the blank, and then click Program -> Add property... menu item, input the follow values:

Customize Property 4

3. Click Program -> Add function... menu item and make the following changes (define the Get method of OnOff property):

Customize Property 5

4. Click Program -> Add function... menu item again and make the following changes (define the Set method of OnOff property):

Customize Property 6

5. Click Functions tab at left and double-click GetOnOff function, write the following script:

return Line3.Visible

6. Click Functions tab at left and double-click SetOnOff function, write the following script:

Line3.Visible = AValue
Line4.Visible = not AValue

7. Rename current sheet as HKnife (change its Name property).

8. Save current file as c:\libtest.tbl.

9. Select Libraries tab and click File -> Open library... menu item, choose libtest.tbl, now you can find HKnife element under libtest group in the Libraries view:

Customize Property 7

10. Create a new file and draw a HKnife on it, switch to Properties view at left, now we can see the OnOff custom property (the first red property):

Customize Property 8

Now, you can change OnOff property to let the HKnife1 On or Off even in the Design mode.

11. The following code demonstrates how to operate HKnife element in your own programming language (maybe need a little change):

' Change file to the actual one that contains a HKnife element and named HKnife1.
vgctrl1.Run "C:\test-lib.tbl""HKnife1.OnOff = false")


AUnit ="HKnife1")
bVal = AUnit.GetPropertyValue("OnOff")
AUnit.SetPropertyValue("OnOff", not bVal)

To operate HKnife1 in Visual Graph scripting language, please select HKnife1 and double-click OnClick event in the Functions view, write the following code, and then click Program -> Run menu item. Just click HKnife1 to experience your good work.

HKnife1.OnOff = not HKnife1.OnOff

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