资源描述:
《vf数据库应用实例》由会员上传分享,免费在线阅读,更多相关内容在教育资源-天天文库。
1、Visual FoxPro技巧与实例大全1。TreeView控件使用示例 以下代码是本演示的全部代码,你只要把它拷贝到任一PRG文件中,执行该文件你就可以看到相应的效果。该代码段在执行后会在目录下自动生成一个Xm.dbf文件,运行后可自行删除。CLEAR ALLCLOSE ALLCLEAR PROGRAMPUBLIC TreeViewCreate_Dbf()oForm = CREATEOBJECT("TreeView")oForm.show()RETURNDEFINE CLASS TreeView AS formHeight =
2、 258Width = 388DoCreate = .T.AutoCenter = .T.Caption = "TreeView 控件示例"MaxButton = .F.MinButton = .F.WindowType = 1BackColor = RGB(128,128,255)Name = "TreeView"Key = 0ADD OBJECT label1 AS label WITH ;BackStyle = 0, ;Caption = "", ;Height = 102, ;Left = 198, ;Top = 16,
3、;Width = 180, ;Name = "Label1"ADD OBJECT command1 AS commandbutton WITH ;Top = 211, ;Left = 217, ;Height = 32, ;Width = 149, ;Caption = "退出演示", ;Name = "Command1"ADD OBJECT command2 AS commandbutton WITH ;Top = 173, ;Left = 217, ;Height = 32, ;Width = 67, ;Caption = "
4、添加节点", ;Name = "Command2"ADD OBJECT command3 AS commandbutton WITH ;Top = 173, ;Left = 299, ;Height = 32, ;Width = 67, ;Caption = "删除节点", ;Name = "Command3"ADD OBJECT tree AS olecontrol WITH ; OLECLASS="COMCTL.TreeCtrl.1",; Top = 0,; Left = 0,; Width = 182
5、,; Height = 258,; HideSelection = .F.PROCEDURE InitSelect xmo = This.TreeScan If AllTrim(Node) = '0_' o.Nodes.Add(, 1, AllTrim(Key), AllTrim(Text)) Else o.Nodes.Add(AllTrim(Node), 4, AllTrim(Key), AllTrim(Text)) EndIfEndScan This.Key = o.Nodes.Count
6、 o.SetfocusENDPROCPROCEDURE Tree.Init This.LabelEdit = 1 This.LineStyle = 1 This.Indentation = 18ENDPROCPROCEDURE command1.ClickCLOSE ALLRELEASE ThisFormENDPROCPROCEDURE command2.Clicko = ThisForm.TreeIF ISNULL(o.SelectedItem) RETURNENDIFThisForm.Key = Thi
7、sForm.Key + 1nKey = ALLTRIM(STR(ThisForm.Key)) + "_"nNode = o.SelectedItem.KeynText = "新添加节点"o.Nodes.Add(nNode, 4, nKey, nText)o.SetfocusENDPROCPROCEDURE command3.Clicko = ThisForm.TreeIF ISNULL(o.SelectedItem) RETURNENDIFIp = o.SelectedItem.Indexo.Nodes.Remove(Ip)o.
8、SetfocusENDPROCPROCEDURE Tree.NodeClickLPARAMETERS nodeIF ISNULL(This.SelectedItem) RETURNENDIFIp = OCCURS("", Node.FullPa