private void Ufrm_Angle_Load(object sender, System.EventArgs e) { hWindow_Final1.HobjectToHimage(ho_Image); if (measureManager == null) { measureManager = form.measureManager; } lines = new List <Line>(); List <MeasuringUnit> units = measureManager.ListAllLine();//获取所有线 foreach (var item in units) { lines.Add(item as Line); cmb_Item1.Items.Add(item.name); cmb_Item2.Items.Add(item.name); } //判断是否编辑模式进入 if (EditMode) { nud_Spacing.Value = data.StringHeight; cbx_AlwaysMinAngel.Visible = false; txt_Name.Text = data.name; //txt_Name.Enabled = false;//编辑模式下不能编辑名字 calculate = data as BaseCal_Single; cmb_Item1.SelectedIndex = Func_System.GetIndex(lines, calculate.unit1 as Line); cmb_Item2.SelectedIndex = Func_System.GetIndex(lines, calculate.unit2 as Line); if (cmb_Item1.SelectedIndex == -1) { calculate.unit1 = new Line(0, 0, 1, 1); } if (cmb_Item2.SelectedIndex == -1) { calculate.unit2 = new Line(0, 0, 1, 1); } nud_MaxValue.Value = (decimal)calculate.maxValue; nud_MinValue.Value = (decimal)calculate.minValue; txt_RealValue.Text = (calculate.hv_RealDistance != null ? calculate.hv_RealDistance.D : 0).ToString("f1"); prepared = true; RunOnce(); } else { calculate = new AngelLineToLine(measureManager.k, new Line(0, 0, 1, 1), new Line(0, 0, 1, 1)); data = calculate; prepared = true; } }
/// <summary> /// 枚举项目 /// </summary> private void EnumItem() { List <MeasuringUnit> lines = measureManager.ListAllLine(); baseLines = new List <Line>(); foreach (var item in lines) { baseLines.Add(item as Line); cmb_Item1.Items.Add(item.name); } lines = measureManager.ListAllLineGroup(); lineGroups = new List <GetSetOfLines>(); foreach (var item in lines) { lineGroups.Add(item as GetSetOfLines); cmb_Item2.Items.Add(item.name); } }
private void Ufrm_Distance_Load(object sender, EventArgs e) { hWindow_Final1.HobjectToHimage(ho_Image); if (measureManager == null) { measureManager = form.measureManager; } if (EditMode) { nud_Spacing.Value = data.StringHeight; txt_Name.Text = data.name; // txt_Name.Enabled = false;//编辑模式下不能编辑名字 //编辑模式 calculate = data as BaseCal_Single; if (calculate is DisPointToPoint) { unitList1 = measureManager.ListAllPoint(); //获取所有点 unitList2 = measureManager.ListAllPoint(); //获取所有点 foreach (var item in unitList1) //添加cmb_Item1项 { cmb_Item1.Items.Add(item.name); } foreach (var item in unitList2)//添加cmb_Item2项 { cmb_Item2.Items.Add(item.name); } rdo_PTP.Checked = true; lab_Item1.Text = "点1"; lab_Item2.Text = "点2"; rdo_PTL.Enabled = false; rdo_LTL.Enabled = false; cmb_Item1.SelectedIndex = Func_System.GetIndex(unitList1, calculate.unit1); cmb_Item2.SelectedIndex = Func_System.GetIndex(unitList2, calculate.unit2); if (cmb_Item1.SelectedIndex == -1) { calculate.unit1 = new Point(0, 0); } if (cmb_Item2.SelectedIndex == -1) { calculate.unit2 = new Point(0, 0); } } if (calculate is DisPointToLine) { unitList1 = measureManager.ListAllPoint(); //获取所有点 unitList2 = measureManager.ListAllLine(); //获取所有线 foreach (var item in unitList1) //添加cmb_Item1项 { cmb_Item1.Items.Add(item.name); } foreach (var item in unitList2)//添加cmb_Item2项 { cmb_Item2.Items.Add(item.name); } rdo_PTL.Checked = true; lab_Item1.Text = "点"; lab_Item2.Text = "线"; rdo_PTP.Enabled = false; rdo_LTL.Enabled = false; cmb_Item1.SelectedIndex = Func_System.GetIndex(unitList1, calculate.unit1); cmb_Item2.SelectedIndex = Func_System.GetIndex(unitList2, calculate.unit2); if (cmb_Item1.SelectedIndex == -1) { calculate.unit1 = new Point(0, 0); } if (cmb_Item2.SelectedIndex == -1) { calculate.unit2 = new Line(0, 0, 1, 1); } } if (calculate is DisLineToLine) { unitList1 = measureManager.ListAllLine(); //获取所有线 unitList2 = measureManager.ListAllLine(); //获取所有线 foreach (var item in unitList1) //添加cmb_Item1项 { cmb_Item1.Items.Add(item.name); } foreach (var item in unitList2)//添加cmb_Item2项 { cmb_Item2.Items.Add(item.name); } rdo_LTL.Checked = true; lab_Item1.Text = "线1"; lab_Item2.Text = "线2"; rdo_PTL.Enabled = false; rdo_PTP.Enabled = false; cmb_Item1.SelectedIndex = Func_System.GetIndex(unitList1, calculate.unit1); cmb_Item2.SelectedIndex = Func_System.GetIndex(unitList2, calculate.unit2); if (cmb_Item1.SelectedIndex == -1) { calculate.unit1 = new Line(0, 0, 1, 1); } if (cmb_Item2.SelectedIndex == -1) { calculate.unit2 = new Line(0, 0, 1, 1); } } nud_MaxValue.Value = (decimal)calculate.maxValue; nud_MinValue.Value = (decimal)calculate.minValue; nud_k.Value = (decimal)calculate.kCx.D; nud_RealValue.Value = (decimal)calculate.hv_RealDistance.D; prepared = true; RunOnce(); } else { nud_k.Value = (decimal)measureManager.k; prepared = true; rdo_LTL.Checked = true; //非编辑模式 } }