using OTSCommon.Model; using OTSIncAReportApp; using OTSIncAReportApp.OTSDataMgrFunction; using OTSIncAReportApp.OTSMgrInfo; using OTSIncAReportApp.SysMgrTools; using System; using System.Data; using System.Windows.Forms; namespace OTSIncAReprotCharts { public partial class frmReportSysConfig : Form { #region 变量 public ResultDataMgr m_DataMgrFun = null; //粒级文件夹路径 public static string m_PathName = ""; //粒级文件夹获取 public static string m_strPath = ""; /// /// 保存的全局主窗体对象 /// frmReportApp m_ReportApp; #endregion #region 构造函数及窗体加载 public frmReportSysConfig(frmReportApp ReportApp) { InitializeComponent(); //粒级部分 this.m_DataMgrFun = ReportApp.m_rstDataMgr; m_ReportApp = ReportApp; //参数设置 tb_sjtmbwj.Text = ""; #region 国际化语言 Language lan = new Language(this); #endregion } private void ReportMgrInfoForm_Load(object sender, EventArgs e) { //初始化数据 InitMyComponent(); } #endregion #region 自定义方法 public void InitMyComponent() { string imagepath; //显示程序管理对话框参数设置 string strbpath = ".\\Config\\ProData\\"; tb_PartiSizeFileFolder.Text = strbpath; imagepath = strbpath; tb_sjtmb.Text = strbpath; tb_sjtmbwj.Text = "DefaultTriTemplateFile.tpf"; //一般参数内的所有textbox不可修改 tb_sjtmb.ReadOnly = true; tb_sjtmbwj.ReadOnly = true; tb_PartiSizeFileFolder.ReadOnly = true; DataSet ds = OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.GetXmlData(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "XMLData"); DataTable dt = ds.Tables["Member"]; string str_scale=""; foreach (DataRow element in dt.Rows) { string RegName = element["RegName"].ToString(); if (RegName == "Scale") { str_scale = element["strValue"].ToString(); } } //比例因子 tb_blyz.Text = str_scale; } private void tb_blyz_KeyPress(object sender, KeyPressEventArgs e) { if (((int)e.KeyChar < 48 || (int)e.KeyChar > 57) && (int)e.KeyChar != 8 && (int)e.KeyChar != 46) e.Handled = true; //小数点的处理。 if ((int)e.KeyChar == 46) //小数点 { if (tb_blyz.Text.Length <= 0) e.Handled = true; //小数点不能在第一位 else { float f; float oldf; bool b1 = false, b2 = false; b1 = float.TryParse(tb_blyz.Text, out oldf); b2 = float.TryParse(tb_blyz.Text + e.KeyChar.ToString(), out f); if (b2 == false) { if (b1 == true) e.Handled = true; else e.Handled = false; } } } } #endregion #region 三元相图相关 //三元相图模板文件夹 private void btn_klljwjj_Click(object sender, EventArgs e) { if (tb_PartiSizeFileFolder.Text == ".\\Config\\ProData\\") { string strb = ".\\Config\\ProData\\"; folderBrowserDialog1.SelectedPath = strb; if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath; } } else { if (folderBrowserDialog1.ShowDialog() == DialogResult.OK) { tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath; } else { tb_PartiSizeFileFolder.Text = folderBrowserDialog1.SelectedPath; } } } private void btn_sjtwj_Click(object sender, EventArgs e) { Triangulation_List tl = new Triangulation_List(m_ReportApp); tl.ShowDialog(); } #endregion #region 粒级相关 //颗粒粒级文件夹 private void btn_sjtmbwjj_Click(object sender, EventArgs e) { //点击颗粒粒级文件夹按钮 folderBrowserDialog1.ShowDialog(); tb_sjtmb.Text = folderBrowserDialog1.SelectedPath; } private void btn_PartSize_Click(object sender, EventArgs e) { frmPartSizeEditorNew fPSEN = new frmPartSizeEditorNew(m_ReportApp, tb_PartiSizeFileFolder.Text); if (fPSEN.ShowDialog() == DialogResult.OK) { } } #endregion #region 报告模板相关 //报表模板 private void btn_bbmbwjj_Click(object sender, EventArgs e) { FolderBrowserDialog ofd = new FolderBrowserDialog(); if (ofd.ShowDialog() == DialogResult.OK) { //tb_bgmb.Text = ofd.SelectedPath + @"\"; } } //参数设置,报告模板文件 private void button2_Click(object sender, EventArgs e) { //if (tb_bgmb.Text != "") //{ // OpenFileDialog op = new OpenFileDialog(); // string strpath = ""; // op.InitialDirectory = tb_bgmb.Text; // if (op.ShowDialog() == DialogResult.OK) // { // strpath = op.FileName; // tb_bgmbwj.Text = strpath; // } //} } #endregion #region 报告参数设置相关 //取消 private void btn_ybcsqx_Click(object sender, EventArgs e) { this.Close(); } public string strParSizeFile = ""; //保存报告文件 private void btn_ybcsbc_Click(object sender, EventArgs e) { double blyz = 0; if (!double.TryParse(tb_blyz.Text.ToString(),out blyz)) { MessageBox.Show("please check params!"); } //参数设置保存功能粒级文件 strParSizeFile = tb_PartiSizeFileFolder.Text; String strTritempFile = tb_sjtmb.Text; string strTritemp = tb_sjtmbwj.Text; //比例因子 OTSIncAReportApp.DataOperation.DataAccess.XMLoperate.EditXmlInfo(Application.StartupPath + RptConfigFile.m_ReportMgrParamFile, "Scale", "strValue", tb_blyz.Text.ToString()); this.Close(); } #endregion } }