//打开文件夹时 public Form openFile(BasicFile clickFile, ref BasicFile fatherFile, ListView fileView, int[] fat, Dictionary <string, BasicFile> fileDictionary, String[] disk) { if (clickFile.Attr == 2) { if (clickFile.IsOpening == true) { MessageBox.Show("不能重复打开文件!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return(null); } //新建文本窗口 TXTFrom txt = new TXTFrom(ref clickFile, ref fat, fileDictionary, disk); txt.Text = clickFile.Name; //设置为已打开状态 return(txt); } else if (clickFile.Attr == 3) { //清空fileShow fileView.Items.Clear(); //设置FileShow里的father fatherFile = clickFile; //显示子目录 if (fatherFile.ChildFile.Count != 0) { foreach (var x in fatherFile.ChildFile) { fileView.Items.Add(x.Value.Item); } } return(null); } return(null); }
//双击事件 private void 打开OToolStripMenuItem_Click(object sender, EventArgs e) { //得到改文件夹,以及该文件夹的父亲 BasicFile clickedFile = getFileByItem(fileView.SelectedItems[0], fileView.View); Form FileFrom = FileFun.openFile(clickedFile, ref father, fileView, parent.fat, parent.openedFileList, parent.disk_Content); if (FileFrom != null) { TXTFrom FileFrom1 = (TXTFrom)FileFrom; SetParent((int)FileFrom1.Handle, (int)this.parent.Handle); FileFrom1.Show(); if (clickedFile.Attr == 2) { this.parent.OpenedFileList.Add(clickedFile.Path, clickedFile); } } if (clickedFile.Attr == 3) { pathShow.Text += @"\" + clickedFile.Name; fileView_Activated(this, e); } }