/// <summary> /// 添加控件元素 /// </summary> /// <param name="FreezeControl"></param> public void Add(PrjUI.PrjFreeze.FreezeBase FreezeControl) { FreezeControl.MouseMoveOver += new CLDC_MeterUI.UI_FA.FAPrj.PrjUI.PrjFreeze.FreezeBase.EventMouseMoveOver(FreezeControl_MouseMoveOver); FreezeControl.MouseMoves += new CLDC_MeterUI.UI_FA.FAPrj.PrjUI.PrjFreeze.FreezeBase.EventMouseMove(FreezeControl_MouseMoves); FreezeControl.PrjSort += new CLDC_MeterUI.UI_FA.FAPrj.PrjUI.PrjFreeze.FreezeBase.EventPrjSort(FreezeControl_PrjSort); FreezeControls.Add(FreezeControl); }
/// <summary> /// 要检项目排序 /// </summary> /// <param name="sender"></param> /// <param name="Index"></param> private void FreezeControl_PrjSort(object sender, int Index) { PrjUI.PrjFreeze.FreezeBase Item = sender as PrjUI.PrjFreeze.FreezeBase; if (FreezeControls.Contains(Item)) { FreezeControlsSort.Add(Index, Item); } }
/// <summary> /// 拷贝需要检定的方案 /// </summary> /// <param name="TaiType"></param> /// <param name="FaName"></param> /// <returns></returns> public CLDC_DataCore.Model.Plan.Plan_Freeze Copy(CLDC_Comm.Enum.Cus_TaiType TaiType, string FaName) { CLDC_DataCore.Model.Plan.Plan_Freeze Freeze = new CLDC_DataCore.Model.Plan.Plan_Freeze((int)TaiType, ""); //创建一个新的多功能方案 for (int i = 0; i < FreezeControls.Count; i++) { PrjUI.PrjFreeze.FreezeBase Item = FreezeControls[i]; if (Item.IsCheck) { Freeze.Add(Item.FreezeID, Item.FreezeName, Item.FreezePlanPrj.OutPramerter.Jion(), Item.Parm); } } Freeze.SetPram((int)TaiType, FaName); return(Freeze); }
/// <summary> /// 控件面板移动完毕事件 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FreezeControl_MouseMoveOver(object sender, EventArgs e) { if (!IsMoved) { return; //如果控件没有移动过 } IsMoved = false; bool IsInsert = false; PrjUI.PrjFreeze.FreezeBase Item = sender as PrjUI.PrjFreeze.FreezeBase; int Index = FreezeControls.FindIndex(delegate(PrjUI.PrjFreeze.FreezeBase FreezeItem) { return(FreezeItem == Item); }); FreezeControls.Remove(Item); for (int i = 0; i < FreezeControls.Count; i++) { if (Item.Top < FreezeControls[i].Top + FreezeControls[i].Height) { FreezeControls.Insert(i, Item); IsInsert = true; Index = i >= Index ? Index : i; break; } } if (!IsInsert) { FreezeControls.Add(Item); } int ScrollValue = 0; if (_CtrParent.VerticalScroll.Visible) { ScrollValue = _CtrParent.VerticalScroll.Value; } this.Sort(Index); if (_CtrParent.VerticalScroll.Visible) { _CtrParent.VerticalScroll.Value = ScrollValue; } }