using DevExpress.XtraEditors; using HL_FristAidPlatform_Public; using System; using System.Collections.Generic; using System.Data; using System.Drawing; using System.Linq; using System.Windows.Forms; namespace HL_FristAidPlatform_Trauma { public partial class Form_HealthCheckupInfo : XtraForm { public string Guid; public string id; public string name; public Dictionary Distionary; public Form_HealthCheckupInfo(string guid) { InitializeComponent(); Guid = guid; Distionary = new Dictionary(); } private void Form_HealthCheckupInfo_Load(object sender, EventArgs e) { //DataTable dt = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=1")); //checkedListBoxControl1.DataSource = dt;//显示分页结果 //this.checkedListBoxControl1.DisplayMember = "Name"; //this.checkedListBoxControl1.ValueMember = "ID"; //DataTable dt1 = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=2")); //if (dt1 != null && dt.Rows.Count > 0) //{ // Dictionary dic = dt1.Rows.Cast().ToDictionary(x => x["ID"].ToString(), x => x["Name"].ToString()); // ucButtonsGroup2.DataSource = dic; //} //DataTable dt2 = DBHelpClass.Get(string.Format("api/base/T_Base_PreHospitalBasicData/GetFristAidRescueMeasures?type=3")); //if (dt2 != null && dt.Rows.Count > 0) //{ // Dictionary dic = dt2.Rows.Cast().ToDictionary(x => x["ID"].ToString(), x => x["Name"].ToString()); // ucButtonsGroup1.DataSource = dic; //} //List lst = DBHelpClass.GetList(string.Format("api/base/T_Base_Diagnosis/GetDiagnosisDetailsList")); //List lstCulumns = new List(); //List list = new List(); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "ID", HeadText = "编号", Width = 80 }); //lstCulumns.Add(new DataGridViewColumnEntity() { DataField = "Name", HeadText = "诊断", Width = 390 }); //this.ucComboxGrid1.GridColumns = lstCulumns; //List lstSourceGrid = new List(); //for (int i = 0; i < lst.Count; i++) //{ // TestGridModel model = new TestGridModel() // { // ID = lst[i].ID, // Name = lst[i].Name, // }; // lstSourceGrid.Add(model); //} //this.ucComboxGrid1.GridDataSource = lstSourceGrid; } private void RiChenck_ButtonClick(object sender, EventArgs e) { //int index = ((System.Windows.Forms.Control)sender).TabIndex; //foreach (Control ctrl in panelControl19.Controls) //{ // if (ctrl is CheckBox) // { // if (ctrl.TabIndex == index) // { // Distionary.Remove(ctrl.TabIndex.ToString()); ; // } // } //} //panelControl19.Controls.Clear(); //if (Distionary.Count > 0) //{ // foreach (var item in Distionary) // { // CheckBox checkBox = new CheckBox(); // checkBox.Text = item.Value; // checkBox.Font = new Font("Tahoma", 13, checkBox.Font.Style); // checkBox.TabIndex = int.Parse(item.Key); // checkBox.AutoSize = true; // checkBox.Checked = true; // checkBox.Dock = System.Windows.Forms.DockStyle.Left; // checkBox.Click += RiChenck_ButtonClick; // panelControl19.Controls.Add(checkBox); // } //} } /// /// 动态添加组件 /// /// /// private void ucComboxGrid3_SelectedChangedEvent(object sender, EventArgs e) { // panelControl19.Controls.Clear(); TestGridModel model = (TestGridModel)sender; if (!Distionary.ContainsKey(model.ID.ToString())) { Distionary.Add(model.ID.ToString(), model.Name); } if (Distionary.Count > 0) { foreach (var item in Distionary) { CheckBox checkBox = new CheckBox(); checkBox.Text = item.Value; checkBox.Font = new Font("Tahoma", 13, checkBox.Font.Style); checkBox.TabIndex = int.Parse(item.Key); checkBox.AutoSize = true; checkBox.Checked = true; checkBox.Dock = System.Windows.Forms.DockStyle.Left; checkBox.Click += RiChenck_ButtonClick; } } } private void simpleButton1_Click(object sender, EventArgs e) { try { this.Close(); } catch (Exception) { throw; } } } } public class TestGridModel { public int ID { get; set; } public string Name { get; set; } //public DateTime Birthday { get; set; } //public int Sex { get; set; } //public int Age { get; set; } //public List Childrens { get; set; } }