public void GetWfGrid(PbBillInfo billInfo) { if (billInfo.WfGridInfo.Visible || billInfo.WfGridInfo.PbBaseTextInfos.Count > 0) { WfGrid = ControlConverter.ConvertToExtPanel(billInfo.WfGridInfo); } }
// 将控件放到指定的容器内, public void FindContain(PbBaseControlInfo control, int x, int y) { if (control is PbTextInfo) { var tempControl = control as PbTextInfo; if (tempControl.Name == "code") { return; //主键不参与布局 } } //若没有容器 //单grid的情况 或者是 tableLayout if (containers.Count == 0) { if (control is PbGridInfo) { var tempPanel = control as PbGridInfo; grids.Add(ControlConverter.ConvertToExtPanel(tempPanel)); } else { layoutForm.Items.Add(control); } return; } ExtContainer targetContain = new ExtContainer(); int i = 0; do { targetContain.X = containers[i].X; targetContain.Y = containers[i].Y; targetContain.Width = containers[i].Width; targetContain.Height = containers[i].Height; if (x >= targetContain.X && x <= targetContain.X + targetContain.Width && y >= targetContain.Y && y <= targetContain.Y + targetContain.Height) { containers[i].Items.Add(control); break; } i++; } while (i < containers.Count); //if (i == containers.Count) //{ // if (control is PbGridInfo) // { // var tempPanel = control as PbGridInfo; // grids.Add(ControlConverter.ConvertToExtPanel(tempPanel)); // } // else // { // layoutForm.Items.Add(control); // } //} }
//panel里面的 public List <GridPanel> GetGridPanel() { //region 默认center foreach (var gridPanel in grids) { foreach (var item in gridPanel.Items) { grids.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)item)); } } CommonParser.Log("Panel转换成功."); return(grids); }
//将控件放到指定的容器内 public void FindContain(PbBaseControlInfo control, int x, int y) { if (control is PbTextInfo) { var tempControl = control as PbTextInfo; if (tempControl.Name == "code") { return; //主键不参与布局 } } if (control.Visible == false && control.ControlType != PbControlType.Grid) { layoutForm.Items.Add(control); return; } //若没有容器 //单grid的情况 或者是 tableLayout if (containers.Count == 0) { if (control is PbGridInfo) { grids.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)control)); } else { layoutForm.Items.Add(control); } return; } else { //有容器(就是pb的groupbox和ng3中的fieldset) ExtContainer targetContain = new ExtContainer(); int i = 0; do { targetContain.X = containers[i].X; targetContain.Y = containers[i].Y; targetContain.Width = containers[i].Width; targetContain.Height = containers[i].Height; if ((x * 1.3) >= targetContain.X && (x * 1.3) <= targetContain.X + targetContain.Width && y >= targetContain.Y && y <= targetContain.Y + targetContain.Height) { if (control is PbGridInfo) { containers[i].Panels.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)control)); //此处会把容器内的grid放进去,后期看看是否要改 } else { containers[i].Items.Add(control); } break; } i++; } while (i < containers.Count); //容器外的grid或列 if (i == containers.Count) { if (control is PbGridInfo) { var tempPanel = control as PbGridInfo; grids.Add(ControlConverter.ConvertToExtPanel(tempPanel)); } else { layoutForm.Items.Add(control); } } } }
//groupbox里面的fieldset public List <FieldSet> GetFieldSetInfo(PbBillInfo billInfo) { //含有groupbox表头 if (billInfo.HeadInfo.PbBaseControlInfos.Count > 0) { //将容器都先放入containers foreach (var headinfo in billInfo.HeadInfo.PbBaseControlInfos) { FieldSet fieldSet = new FieldSet(); fieldSet.X = headinfo.XPos; fieldSet.Y = headinfo.YPos; fieldSet.Width = headinfo.Width; fieldSet.Height = headinfo.Height; fieldSet.ID = headinfo.Id; fieldSet.Title = ((PbGroupboxInfo)(headinfo)).Text; containers.Add(fieldSet); } } foreach (var pbColumn in billInfo.HeadInfo.PbColumns) { //将控件放到指定的容器内 FindContain(pbColumn, pbColumn.XPos, pbColumn.YPos); } //因为要赋值回去,所以不能foreach for (int i = 0; i < containers.Count; i++) { Dictionary <int, SortedList <int, PbBaseControlInfo> > dic = new Dictionary <int, SortedList <int, PbBaseControlInfo> >(); containers[i].Items = this.Sort(containers[i].Items, ref dic); //计算该fieldset 每行最多的colspan //算占多少 //不能用ref 动态类 containers[i] = CalColSpan(containers[i], dic); } //含有表体 if (billInfo.PbGrids.Count > 0) { foreach (var gridpanel in billInfo.PbGrids) { FindContain(gridpanel, gridpanel.XPos, gridpanel.YPos); } } //含有金格控件 if (billInfo.OfficeInfo.Visible) { FieldSet fieldSet = new FieldSet(); fieldSet.X = billInfo.OfficeInfo.XPos; fieldSet.Y = billInfo.OfficeInfo.YPos; fieldSet.Width = billInfo.OfficeInfo.Width; fieldSet.Height = billInfo.OfficeInfo.Height; fieldSet.Title = "金格控件"; containers.Add(fieldSet); } //含有进度控件 if (billInfo.ScheduleInfo.Visible) { FieldSet fieldSet = new FieldSet(); fieldSet.X = billInfo.ScheduleInfo.XPos; fieldSet.Y = billInfo.ScheduleInfo.YPos; fieldSet.Width = billInfo.ScheduleInfo.Width; fieldSet.Height = billInfo.ScheduleInfo.Height; fieldSet.Title = "进度控件"; containers.Add(fieldSet); } //为容器内的控件进行布局 region SetLayout(); for (int i = 0; i < containers.Count; i++) { //转类型 foreach (var item in containers[i].Items) { if (item is PbGridInfo) { containers[i].Panels.Add(ControlConverter.ConvertToExtPanel((PbGridInfo)item)); } else { containers[i].AllFields.Add(ControlConverter.ConvertToExtControl(item)); } //PbBaseControlInfo pbcontrol = item; // expressions.Add(()pbcontrol.); } } CommonParser.Log("GroupBox转换成功."); return(containers); }