/// <summary> /// TreeNode结点,右键菜单选中事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void cmsSheetNode_ItemClicked(Object sender, ToolStripItemClickedEventArgs e) { //获取所点击的结点名称 String sheetName = treeViewExcels.SelectedNode.Text; //复制表名 if (e.ClickedItem.Text.Contains(ConstantText.CopySheetName)) { Clipboard.SetText(sheetName); return; } //映射该表 if (e.ClickedItem.Text.Contains(ConstantText.MappingTable)) { //实例化弹出映射窗体 TableMapping tableMapping = new TableMapping(sheetName, mExcelFileInfos[treeViewExcels.SelectedNode.Parent.Text], this); tableMapping.ShowDialog(this); //改变所选节点,映射状态 XMLHelper xmlHelper = new XMLHelper("TableMapping.xml"); if (xmlHelper.GetTableNameMapping(sheetName) != null) { treeViewExcels.SelectedNode.ForeColor = Color.Red; treeViewExcels.SelectedNode.ToolTipText = ConstantText.MappingExist; } else { treeViewExcels.SelectedNode.ForeColor = Color.Black; treeViewExcels.SelectedNode.ToolTipText = ConstantText.ClickToCopy; } } }