Back to Home
Visual Graph Home
TriSun Software Inc. Home
Visual Graph Site Menu
What is Visual Graph?
50 Technical Features
Abundant Graphic Libraries
Online Demo (IE Only)
Visual Graph Getting Started
Use VG Component in Delphi 6
Use VG Component in VB6
Use Graphic Library
Change Element's Shape
Make Graphic Button
Get the Selected Elements
Dynamically Create Graph
Use Line Vertexes
Call Windows API Functions
Call Visual Graph Functions
Callback Control Event in Script
Drag Graph in Run Mode
Make and Use Dialog Box
Visual Graph Getting Started - Customize PropertyNow, 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:
Now, explain how to do it.
1. Draw 2 circles and 4 lines like this:
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:
3. Click Program -> Add function... menu item and make the following changes (define the Get method of OnOff property):
4. Click Program -> Add function... menu item again and make the following changes (define the Set method of OnOff property):
5. Click Functions tab at left and double-click GetOnOff function, write the following script:
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:
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):
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.vg.Execute("HKnife1.OnOff = false")
AUnit = vgctrl1.vg.ActiveSheet.UnitByName("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
Legal Notices |
Contact Us |
Copyright© 2004-2017 TriSun Software Inc. All rights reserved.