//单击内置模板会载入内置模板 private void cmbTpl_SelectedIndexChanged(object sender, EventArgs e) { string tpl_name = this.cmbTpl.Text;//.SelectedIndex. >= 2) //如果是自定义模板,则啥也不管 if (this.cmbTpl.SelectedIndex == 0) { return; } //实例化内置模板类 InnerTpl form_inner_tpl = new InnerTpl(); //MessageBox.Show(tpl_name); //获取模板内容 Info[,] tpl = form_inner_tpl.getTplByName(tpl_name); //先初始化模板-重置所有方格 DgvCtrl.clearAllCells(this.dataGridView0, this.dataGridView1); //中间信息写到界面上 DataReadWrite.readIntoUI(tpl, this.dataGridView0, this.dataGridView1); }
private void initTplList(int index) { //添加组合框-内置模板(因为要后续扩展,所以没写死) //实例化内置模板类 InnerTpl form_inner_tpl = new InnerTpl(); //调用方法,返回现有内置的模板名字 string[] inner_tpls = form_inner_tpl.getInnerTplNames(); //显示到下拉框控件中 cmbTpl.DataSource = inner_tpls; cmbTpl.SelectedIndex = index; //该控件只能选择,不能编辑 cmbTpl.DropDownStyle = ComboBoxStyle.DropDownList; cmbTpl.FlatStyle = FlatStyle.Popup;//样式 }
//单击内置模板会载入内置模板 private void cmbTpl_SelectedIndexChanged(object sender, EventArgs e) { string tpl_name=this.cmbTpl.Text;//.SelectedIndex. >= 2) //如果是自定义模板,则啥也不管 if (this.cmbTpl.SelectedIndex == 0) { return; } //实例化内置模板类 InnerTpl form_inner_tpl = new InnerTpl(); //MessageBox.Show(tpl_name); //获取模板内容 Info[,] tpl = form_inner_tpl.getTplByName(tpl_name); //先初始化模板-重置所有方格 DgvCtrl.clearAllCells(this.dataGridView0, this.dataGridView1); //中间信息写到界面上 DataReadWrite.readIntoUI(tpl, this.dataGridView0, this.dataGridView1); }