在网上找了半天都没有发现用Powerbuilder调用Visual Graph控件的例子,就是北京图王公司的网站上都没有pb的例子。现在做了一个,供大家参考。
这是一个测试窗口w_test的代码,用PB11.5写的,在导入到PBL库之前先注册Visual Graph控件。
forward
global type w_test from window
end type
type cb_5 from commandbutton within w_test
end type
type cb_3 from commandbutton within w_test
end type
type vgctrl2 from olecustomcontrol within w_test
end type
type cb_4 from commandbutton within w_test
end type
type cb_2 from commandbutton within w_test
end type
type cb_1 from commandbutton within w_test
end type
type vgctrl1 from olecustomcontrol within w_test
end type
end forward
global type w_test from window
integer width = 2770
integer height = 1728
boolean titlebar = true
string title = "Untitled"
boolean controlmenu = true
boolean minbox = true
boolean maxbox = true
boolean resizable = true
long backcolor = 67108864
string icon = "AppIcon!"
boolean center = true
cb_5 cb_5
cb_3 cb_3
vgctrl2 vgctrl2
cb_4 cb_4
cb_2 cb_2
cb_1 cb_1
vgctrl1 vgctrl1
end type
global w_test w_test
on w_test.create
this.cb_5=create cb_5
this.cb_3=create cb_3
this.vgctrl2=create vgctrl2
this.cb_4=create cb_4
this.cb_2=create cb_2
this.cb_1=create cb_1
this.vgctrl1=create vgctrl1
this.Control[]={this.cb_5,&
this.cb_3,&
this.vgctrl2,&
this.cb_4,&
this.cb_2,&
this.cb_1,&
this.vgctrl1}
end on
on w_test.destroy
destroy(this.cb_5)
destroy(this.cb_3)
destroy(this.vgctrl2)
destroy(this.cb_4)
destroy(this.cb_2)
destroy(this.cb_1)
destroy(this.vgctrl1)
end on
event open;vgctrl1.object.design(gs_hlp_path+"test.tbl")
vgctrl2.object.run(gs_hlp_path+"电脑设备.tbl")
end event
type cb_5 from commandbutton within w_test
integer x = 1591
integer y = 1408
integer width = 457
integer height = 112
integer taborder = 40
integer textsize = -10
integer weight = 400
fontcharset fontcharset = ansi!
fontpitch fontpitch = variable!
fontfamily fontfamily = swiss!
string facename = "Arial"
string text = "保护"
end type
event clicked;OLEobject IUnit
integer