以下是引用cluna2013在2018-6-24 05:42:16的发言:
很感谢您提供帮助!遗憾的是文件下载打不开。结完贴也打不开。能否再发过?
刚试过,可以正常下载。
主要有两个文件:
表单:表单1
自定义类:myclass
参考用VFP的类浏览器导出的代码:全部放到test.prg运行
** test.prg
PUBLIC oform1
SET CLASSLIB TO c:\temp\即指即现\myclass.vcx ADDITIVE
oform1=NEWOBJECT("form1")
oform1.Show
RETURN
**************************************************
*-- Form:
form1 (c:\temp\即指即现\表单1.scx)
*-- 父类:
form
*-- 基类:
form
*-- 时间戳:
06/23/18 10:30:07 PM
*
DEFINE CLASS form1 AS form
Top = 11
Left = 29
Height = 308
Width = 384
ShowWindow = 2
DoCreate = .T.
ShowTips = .T.
Caption = "Form1"
Name = "Form1"
ADD OBJECT list1 AS listbox WITH ;
FontSize = 11, ;
FirstElement = 1, ;
Height = 144, ;
Left = 12, ;
NumberOfElements = 0, ;
TabIndex = 3, ;
Top = 144, ;
Visible = .F., ;
Width = 312, ;
Name = "List1"
ADD OBJECT mytextbox1 AS mytextbox WITH ;
FontSize = 14, ;
Height = 30, ;
Left = 24, ;
Top = 99, ;
Width = 144, ;
Name = "Mytextbox1"
ADD OBJECT mytextbox2 AS mytextbox WITH ;
FontSize = 14, ;
Height = 30, ;
Left = 24, ;
Top = 60, ;
Width = 144, ;
Name = "Mytextbox2"
ADD OBJECT mytextbox3 AS mytextbox WITH ;
FontSize = 14, ;
Height = 30, ;
Left = 24, ;
Top = 22, ;
Width = 144, ;
Name = "Mytextbox3"
ADD OBJECT label1 AS label WITH ;
AutoSize = .T., ;
FontSize = 12, ;
BorderStyle = 1, ;
Caption = "Label1", ;
Height = 20, ;
Left = 216, ;
Top = 36, ;
Visible = .F., ;
Width = 50, ;
BackColor = RGB(233,234,191), ;
Name = "Label1"
PROCEDURE Load
CREATE CURSOR tt (f1 I, f2 I, f3 I)
FOR i=1 TO 10
INSERT INTO tt VALUES (i, i*2, i*3)
ENDFOR
ENDPROC
PROCEDURE Init
WITH THISFORM.LIST1
.COLUMNCOUNT=FCOUNT([tt])
.COLUMNWIDTHS=[86,86,86]
.ROWSOURCETYPE=6
.ROWSOURCE=[tt.f3,f2,f1]
.VISIBLE=.T.
.REQUERY
ENDWITH
THISFORM.myTextbox3.ControlSource=[tt.f3]
THISFORM.myTextbox2.ControlSource=[tt.f2]
THISFORM.myTextbox1.ControlSource=[tt.f1]
ENDPROC
PROCEDURE list1.Click
THISFORM.REFRESH
ENDPROC
ENDDEFINE
*
*-- EndDefine: form1
**************************************************
**************************************************
*-- 类:
mytextbox (c:\temp\即指即现\myclass.vcx)
*-- 父类:
textbox
*-- 基类:
textbox
*-- 时间戳:
06/23/18 10:25:01 PM
*
DEFINE CLASS mytextbox AS textbox
BorderStyle = 0
Height = 20
ReadOnly = .T.
Width = 100
Name = "mytextbox"
PROCEDURE MouseEnter
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.label1.top = nYCoord
thisform.label1.left = nXCoord
thisform.label1.Caption = ICASE(;
This.Value%3==0, '甲子乙丑海中金',;
This.Value%3==1, '甲寅乙卯大溪水',;
This.Value%3==2, '甲辰乙巳覆灯火',"")
thisform.label1.Visible = .T.
ENDPROC
PROCEDURE MouseLeave
LPARAMETERS nButton, nShift, nXCoord, nYCoord
thisform.label1.Visible = .F.
ENDPROC
ENDDEFINE
*
*-- EndDefine: mytextbox
**************************************************