类声明一样的时候,怎么简写?
程序代码:&&求一元二次方程.prg
of = CREATEOBJECT("fm1")
of.Show
READ EVENTS
DEFINE CLASS fm1 as Form
WindowType = 1
ShowWindow = 2
Desktop = .T.
AutoCenter = .T.
Caption="求一元二次方程"
left=77
top=29
height=282
width=852
ADD OBJECT label1 as myLbl1 WITH top=39,left=203
ADD OBJECT label2 as myLbl2 WITH top=46,left=239
ADD OBJECT label3 as myLbl3 WITH top=39,left=346
ADD OBJECT label4 as myLbl4 WITH top=39,left=346
ADD OBJECT label5 as myLbl5 WITH top=42,left=252
ADD OBJECT label6 as myLbl6 WITH top=46,left=483
ADD OBJECT label7 as myLbl7 WITH top=40,left=551
ADD OBJECT label8 as myLbl8 WITH top=196,left=48
ADD OBJECT label9 as myLbl9 WITH top=24,left=24
ADD OBJECT text1 as myTxt1 WITH top=52,left=143
ADD OBJECT text2 as myTxt2 WITH top=52,left=287
ADD OBJECT text3 as myTxt3 WITH top=52,left=419
ADD OBJECT cmdCalc as myCmd1 WITH top=148,left=167
ADD OBJECT cmdExit as myCmd2 WITH top=148,left=491
ADD OBJECT cmdRetry as myCmd3 WITH top=244,left=683
PROCEDURE UnLoad
CLEAR EVENTS
ENDPROC
ENDDEFINE
DEFINE CLASS myLbl1 as Label
Visible = .T.
caption = "x"
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl2 as Label
Visible = .T.
caption = "2"
BackStyle=0
AutoSize=.T.
FontSize=20
ENDDEFINE
DEFINE CLASS myLbl3 as Label
Visible = .T.
caption = "x"
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl4 as Label
Visible = .T.
caption = "x"
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl5 as Label
Visible = .T.
caption = "+"
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl6 as Label
Visible = .T.
caption = "="
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl7 as Label
Visible = .T.
caption = "0"
BackStyle=0
AutoSize=.T.
FontSize=50
ENDDEFINE
DEFINE CLASS myLbl8 as Label
Visible = .T.
caption = ""
BackStyle=0
AutoSize=.T.
FontSize=20
ENDDEFINE
DEFINE CLASS myLbl9 as Label
Visible = .T.
caption = '说明:先输入方程的系数,然后按“求解”按钮,即可求出方程的根。'
BackStyle=0
AutoSize=.T.
FontSize=12
ENDDEFINE
DEFINE CLASS myTxt1 as TextBox
Visible = .T.
caption = ""
BackStyle=0
BorderStyle=1
AutoSize=.T.
FontSize=40
Height=49
Width=61
ENDDEFINE
DEFINE CLASS myTxt2 as TextBox
Visible = .T.
caption = ""
BackStyle=0
BorderStyle=1
AutoSize=.T.
FontSize=40
Height=49
Width=61
ENDDEFINE
DEFINE CLASS myTxt3 as TextBox
Visible = .T.
caption = ""
BackStyle=0
BorderStyle=1
AutoSize=.T.
FontSize=40
Height=49
Width=61
ENDDEFINE
DEFINE CLASS myCmd1 as CommandButton
Visible = .T.
caption = "求解"
height = 25
width = 85
PROCEDURE Click
thisform.label8.caption="" &&用label8输出方程的结果,先修改其caption属性为“”(空)。
a=VAL(thisform.text1.value) &&以下三行读取方程的系数
b=VAL(thisform.text2.value)
c=VAL(thisform.text3.value)
IF a!=0
d=b*b-4*a*c &&求delta的值
DO CASE
CASE d=0
x=-b/(2*a)
thisform.label8.caption="方程有一个实根:"+ALLT(STR(x,8,2))+"。" &&把数值转换为字符时,要注意str()的用法,否则只有整数
CASE d>0
x1=(-b+SQRT(d))/(2*a)
x2=(-b-SQRT(d))/(2*a)
thisform.label8.caption="方程有两个实根,分别是:"+ALLT(STR(x1,8,2))+"和"+ALLT(STR(x2,8,2))+"。"
CASE d<0
sb=-b(2*a)
xb=SQRT(-d)/(2*a)
thisform.label8.caption="方程有两个复数根,分别是:"+ALLTRIM(STR(sb,8,2))+"+"+"allt(STR(xb,8,2))+"i"+"和"+ALLTRIM(STR(sb,8,2))+"-"+ALLTRIM(STR(xb,8,2))+"i"+"。""
ENDCASE
ELSE
IF b!=0
thisform.label8.caption="方程是一次方程,其根为:"+ALLTRIM(STR(-c/b,8,2))+"。"
ELSE
thisform.label8.caption="由于二次项和一次项的系统均为0,不能构成一个方程。"
ENDIF
ENDIF
ENDPROC
ENDDEFINE
DEFINE CLASS myCmd2 as CommandButton
Visible = .T.
caption = "退出"
height = 25
width = 85
PROCEDURE Click
thisform.Release
ENDPROC
ENDDEFINE
DEFINE CLASS myCmd3 as CommandButton
Visible = .T.
caption = "再来一题"
height = 25
width = 85
PROCEDURE Click
thisform.text1.value=""
thisform.text2.value=""
thisform.text3.value=""
thisform.text1.setfocus
thisform.refresh
ENDPROC
ENDDEFINE三个TextBox的DEFINE部门都一样,怎么简写?









