// 下拉框选择子项事件 private void ComboBox_SelectedIndexChanged(object sender, EventArgs e) { ComboBox comB = (ComboBox)sender; if (outputComBox != null && outputComBox.Equals(comB) && comB.Focused) { List <Dictionary <string, string> > dataDic = dateTabelStrToList(inputDGV); // 获取最终内容 string str = beGetSetTotalMethod(dataDic); ExportComBoxValEnum val = ExportComBox.stringToEnum(comB.SelectedValue.ToString()); switch (val) { case ExportComBoxValEnum.EXPORT_NEW_PAGE_VAL: // 新标签 if (str.Length > 0) { MainTabControlUtils.ExportNewPage(str); } break; case ExportComBoxValEnum.EXPORT_THIS_PAGE_VAL: // 当前标签 if (str.Length > 0) { ControlsUtils.ExportThisPage(str); } break; case ExportComBoxValEnum.EXPORT_JAVA_VAL: // java文件 if (str.Length > 0) { FileUtils.SaveJavaFile(str, classNameStr, encoding); } break; case ExportComBoxValEnum.EXPORT_NOTEBOOK_VAL: // 记事本 if (str.Length > 0) { FileUtils.TurnOnNotepad(str); } break; } } if (输入_类型规则_comB.Equals(comB) && comB.Focused) { if ("数据库".Equals(comB.SelectedItem)) { TypeRule = 0; } else if ("JAVA对象".Equals(comB.SelectedItem) && comB.Focused) { TypeRule = 1; } } }
/// <summary> /// 导出数据到新标签 /// </summary> public void exportNewPage() { string s = resultTextBox.SelectionLength == 0? resultTextBox.Text : resultTextBox.SelectedText; MainTabControlUtils.ExportNewPage(s); }