PublicFunction ClsName(Obj As Object) As String If TypeOf Obj IsFormThen ClsName ="Form":ExitFunction If TypeOf Obj Is Frame Then ClsName ="Frame":ExitFunction If TypeOf Obj Is PictureBox Then ClsName ="PictureBox":ExitFunction
If TypeOf Obj Is CheckBox Then ClsName ="CheckBox":ExitFunction If TypeOf Obj Is ComboBox Then ClsName ="ComboBox":ExitFunction If TypeOf Obj Is CommandButton Then ClsName ="CommandButton":ExitFunction If TypeOf Obj Is Data Then ClsName ="Data":ExitFunction If TypeOf Obj Is DirListBox Then ClsName ="DirListBox":ExitFunction If TypeOf Obj Is DriveListBox Then ClsName ="DriveListBox":ExitFunction If TypeOf Obj Is FileListBox Then ClsName ="FileListBox":ExitFunction If TypeOf Obj Is HScrollBar Then ClsName ="HScrollBar":ExitFunction If TypeOf Obj Is Image Then ClsName ="Image":ExitFunction If TypeOf Obj Is Label Then ClsName ="Label":ExitFunction If TypeOf Obj Is Licenses Then ClsName ="Licenses":ExitFunction If TypeOf Obj Is Line Then ClsName ="Line":ExitFunction If TypeOf Obj Is ListBox Then ClsName ="ListBox":ExitFunction If TypeOf Obj Is MDIForm Then ClsName ="MDIForm":ExitFunction If TypeOf Obj Is OLE Then ClsName ="OLE":ExitFunction If TypeOf Obj Is OptionButton Then ClsName ="OptionButton":ExitFunction If TypeOf Obj Is PropertyPage Then ClsName ="PropertyPage":ExitFunction If TypeOf Obj Is Shape Then ClsName ="Shape":ExitFunction If TypeOf Obj Is TextBox Then ClsName ="TextBox":ExitFunction If TypeOf Obj Is Timer Then ClsName ="Timer":ExitFunction If TypeOf Obj Is UserControl Then ClsName ="UserControl":ExitFunction If TypeOf Obj Is UserDocument Then ClsName ="UserDocument":ExitFunction If TypeOf Obj Is VBControlExtender Then ClsName ="VBControlExtender":ExitFunction If TypeOf Obj Is VScrollBar Then ClsName ="VScrollBar":ExitFunction ClsName ="非内部控件" EndFunction
发到VBgood,又做了一些修改。
PublicFunction ClsName(Obj As Object) As String If TypeOf Obj IsFormThen ClsName ="Form":ExitFunction If TypeOf Obj Is PropertyPage Then ClsName ="PropertyPage":ExitFunction If TypeOf Obj Is UserControl Then ClsName ="UserControl":ExitFunction If TypeOf Obj Is UserDocument Then ClsName ="UserDocument":ExitFunction If TypeOf Obj Is VBControlExtender Then ClsName ="VBControlExtender":ExitFunction ClsName =TypeName(Obj) EndFunction