验证系统?
我按坛友wjp456789给的那个界面 也做了一个如下图555 传不了图?
我现在的问题是 怎么删除一个已添加的对象?
可以看出 我先建立了一个容器类 里面有三个控件 我怎么在主程序里 删除一个容器对象里面的一个控件?
我试图用release方法 来做 但是失败了 那几段代码我注释掉了 按理说应该是用release 吧 可能是我不会用。
我的原始程序代码如下:
程序代码:
Clear All Public gn_HalfWndHeight as Integer Public gn_HalfWndWidth as Integer Public gn_Space gn_HalfWndHeight = 280 gn_HalfWndWidth = 400 gn_Space = 30 *On Error do errHandler with Error(), Message(), Message(1), Program(), Lineno() Main() *On Error Clear All Return *!* Procedure errHandler(merror, mmess, mmess1, mprog, mlineno) *!* MessageBox(Str(mlineno) + "表达式错误:" + mmess) *!* EndProc Procedure Main() Local lo_MainForm lo_MainForm = NewObject("C_Form") lo_MainForm.show Read EVENTS Return EndProc Define Class C_Container as Container BorderWidth = 2 SpecialEffect = 0 Width = 2 * (gn_HalfWndWidth - gn_Space) Height = 50 Add Object lo_Label as Label With Caption = "记得改变我:", Alignment = 2 , Left = 10, Top = 10,; Height = 30, Width = 150, FontSize = 16&&, BackColor = Rgb(255, 0, 0) Add Object lo_Text as TextBox With Left = This.lo_Label.Left + This.lo_Label.Width + gn_Space,; Top = This.lo_Label.Top, Height = This.lo_Label.Height, BorderWidth = 0,; Width = 200, Alignment = 0, Value = 0, Alignment = 1 Add Object lo_Button as CommandButton With Left = This.lo_Text.Left + This.lo_Text.Width +; gn_Space, Width = This.Width / 2 - (This.lo_Text.Left + This.lo_Text.Width + ; 2 * gn_Space) / 2, Top = This.lo_Label.Top, Caption = "记得改变我", Themes = 0,; Height = This.lo_Label.Height , FontSize = 16 *!* Procedure Release *!* Release this *!* EndProc EndDefine Define Class C_Form as Form MaxButton = .F. Caption = "身份证号检验系统" AutoCenter = .T. ShowWindow = 2 BorderStyle = 2 Add Object lo_Caption as Label with Top = 10, Caption = "身份证号检验系统",; FontSize = 20, AutoSize = .T. , FontName = "楷体" Add Object lo_Number as C_Container with Top = This.lo_Caption.Top + 40 +; This.lo_Caption.Height, Left = gn_Space *!* Procedure lo_Number.Init *!* Local i as Integer *!* i = This.Height *!* MessageBox(Str(i)) *!* EndProc Add Object lo_Province as C_Container with Top = This.lo_Number.Top +; This.lo_Number.Height, Left = This.lo_Number.Left Add Object lo_Area as C_Container with Top = This.lo_Province.Top +; This.lo_Province.Height, Left = This.lo_Number.Left Add Object lo_City as C_Container with Top = This.lo_Area.Top +; This.lo_Area.Height, Left = This.lo_Number.Left Add Object lo_Date as C_Container with Top = This.lo_City.Top +; This.lo_City.Height, Left = This.lo_Number.Left Add Object lo_Sex as C_Container with Top = This.lo_Date.Top +; This.lo_Date.Height, Left = This.lo_Number.Left Add Object lo_Address as C_Container with Top = This.lo_Sex.Top +; This.lo_Sex.Height, Left = This.lo_Number.Left Add Object lo_Result as C_Container with Top = This.lo_Address.Top +; This.lo_Address.Height, Left = This.lo_Number.Left Procedure lo_Caption.Init With This .Left = gn_HalfWndWidth - .Width / 2 EndWith EndProc Procedure lo_Date.Init With This .lo_Label.Caption = "出生年月日:" .lo_Button.Caption = "干掉我" EndWith EndProc Procedure lo_Result.Init With This .lo_Label.Caption = "最终结果:" .lo_Button.Caption = "干掉我" .Height = 100 .lo_Text.Width = 400 .lo_Text.Height = 50 EndWith EndProc *!* Procedure Release *!* lo_Province.Release *!* EndProc Procedure Init With This .Top = 100 .Left = 100 .Height = gn_HalfWndHeight * 2 .Width = gn_HalfWndWidth * 2 EndWith EndProc Procedure Destroy Local ln_Confirm _screen.ActiveForm.Tag = "0" ln_Confirm = MessageBox("你确定要退出验证系统吗?" , 4 + 32, "退出?") If ln_Confirm == 6 Clear Events Else _screen.ActiveForm.Tag = "1" ThisForm.Activate ThisForm.Show EndIf EndProc EndDefine