//删除韵母表选中行 private void ym_del_Click(object sender, EventArgs e) { if (dataGridView_ym.SelectedRows.Count > 0) { yunmu ymobj = dataGridView_ym.SelectedRows[0].Tag as yunmu; Cursor.Current = Cursors.WaitCursor; try { if (ym_list.Remove(ymobj)) { RefreshYmList(); } else { MessageBox.Show("删除失败!"); } } finally { Cursor.Current = Cursors.Default; } } else { MessageBox.Show("请选择要删除的行!", "系统提示"); } }
//新增韵母表 private void ym_add_Click(object sender, EventArgs e) { yunmu ymobj = new yunmu(); ymobj.id = ym_id; ymobj.count = ymtxt1.Text.Trim() + "&" + ym_combox.Text.Trim() + "&" + ymtxt2.Text.Trim(); ym_list.Add(ymobj); RefreshYmList(); ym_id++; ymtxt1.Focus(); }
/// <summary> /// 刷新列表 /// </summary> /// <param name="id"></param> public void RefreshCode(int id) { Cursor.Current = Cursors.WaitCursor; _obj = bll.Get(id); if (_obj != null) { smtxt1.Text = ""; sm_combox.Text = "→"; smtxt2.Text = ""; ymtxt1.Text = ""; ym_combox.Text = "→"; ymtxt2.Text = ""; CommonHelper.setForm(_obj, panel1.Controls); sm_list = new List <shengmu>(); if (!string.IsNullOrEmpty(_obj.SHENGMU)) { string[] shengmulit = null; shengmulit = _obj.SHENGMU.Split('〓'); for (int i = 0; i < shengmulit.Length; i++) { shengmu sm_obj = new shengmu() { id = i + 1, count = shengmulit[i] }; sm_list.Add(sm_obj); } RefreshSmList(); } ym_list = new List <yunmu>(); if (!string.IsNullOrEmpty(_obj.YUNMU)) { string[] yunmulit = null; yunmulit = _obj.YUNMU.Split('〓'); for (int i = 0; i < yunmulit.Length; i++) { yunmu ym_obj = new yunmu() { id = i + 1, count = yunmulit[i] }; ym_list.Add(ym_obj); } RefreshYmList(); } } else { SetDefault(); } Cursor.Current = Cursors.Default; }