public void DoFill(List<PriceCate> list) { PriceCateGrid.Redim(0, 0); PriceCateGrid.FixedRows = 1; PriceCateGrid.FixedColumns = 1; PriceCateGrid.EnableSort = true; PriceCateGrid.Redim(list.Count + 1, 7); PriceCateGrid.Rows[0].Height = 25; PriceCateGrid[0, 0] = new MyHeader("描述"); PriceCateGrid[0, 0].Column.Width = 200; PriceCateGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 1] = new MyHeader("价格1"); PriceCateGrid[0, 1].Column.Width = 150; PriceCateGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 2] = new MyHeader("价格2"); PriceCateGrid[0, 2].Column.Width = 150; PriceCateGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 3] = new MyHeader("价格3"); PriceCateGrid[0, 3].Column.Width = 150; PriceCateGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 4] = new MyHeader("价格4"); PriceCateGrid[0, 4].Column.Width = 150; PriceCateGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 5] = new MyHeader("价格5"); PriceCateGrid[0, 5].Column.Width = 150; PriceCateGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); PriceCateGrid[0, 6] = new MyHeader("状态"); PriceCateGrid[0, 6].Column.Width = 80; PriceCateGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (PriceCate item in list) { PriceCateGrid.Rows[r].Tag = item.Id; PriceCateGrid.Rows[r].Height = 25; PriceCateGrid[r, 0] = new SourceGrid.Cells.Cell(item.CateName); PriceCateGrid[r, 0].AddController(clickEvent); string p1 = item.UsePrice1 ? item.Price1Name + ": " + item.Price1Val : ""; PriceCateGrid[r, 1] = new SourceGrid.Cells.Cell(p1); PriceCateGrid[r, 1].AddController(clickEvent); string p2 = item.UsePrice2 ? item.Price2Name + ": " + item.Price2Val : ""; PriceCateGrid[r, 2] = new SourceGrid.Cells.Cell(p2); PriceCateGrid[r, 2].AddController(clickEvent); string p3 = item.UsePrice3 ? item.Price3Name + ": " + item.Price3Val : ""; PriceCateGrid[r, 3] = new SourceGrid.Cells.Cell(p3); PriceCateGrid[r, 3].AddController(clickEvent); string p4 = item.UsePrice4 ? item.Price4Name + ": " + item.Price4Val : ""; PriceCateGrid[r, 4] = new SourceGrid.Cells.Cell(p4); PriceCateGrid[r, 4].AddController(clickEvent); string p5 = item.UsePrice5 ? item.Price5Name + ": " + item.Price5Val : ""; PriceCateGrid[r, 5] = new SourceGrid.Cells.Cell(p5); PriceCateGrid[r, 5].AddController(clickEvent); string status = item.Status == "A" ? "启用" : "未启用"; PriceCateGrid[r, 6] = new SourceGrid.Cells.Button(status); PriceCateGrid[r, 6].AddController(clickEvent); r++; } PriceCateGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public CellPoints(int p_Value) : base(p_Value, typeof(int)) { View = s_NoBorderInt; SourceGrid.Cells.Controllers.CustomEvents events = new SourceGrid.Cells.Controllers.CustomEvents(); events.ValueChanged += new EventHandler(events_ValueChanged); AddController(events); }
private void CustomInitialization() { i = 0; s1 = new Step_frez(); //ToDo переместить на место AList = new ArrayList(); cellpointer = new MyCellTracking(); rowpointer = new MyRowTrecking(); clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); }
public void DoFill(List<Supplier> list) { SupplierGrid.Redim(0, 0); SupplierGrid.FixedRows = 1; SupplierGrid.FixedColumns = 1; SupplierGrid.EnableSort = true; SupplierGrid.Redim(list.Count + 1, 5); SupplierGrid.Rows[0].Height = 25; SupplierGrid[0, 0] = new MyHeader("公司"); SupplierGrid[0, 0].Column.Width = 250; SupplierGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 1] = new MyHeader("联系人"); SupplierGrid[0, 1].Column.Width = 200; SupplierGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 2] = new MyHeader("备注"); SupplierGrid[0, 2].Column.Width = 300; SupplierGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 3] = new MyHeader("地址"); SupplierGrid[0, 3].Column.Width = 200; SupplierGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SupplierGrid[0, 4] = new MyHeader(""); SupplierGrid[0, 4].Column.Width = 100; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (Supplier item in list) { SupplierGrid.Rows[r].Tag = item.Id; SupplierGrid.Rows[r].Height = 35; SupplierGrid[r, 0] = new SourceGrid.Cells.Cell(item.Name); SupplierGrid[r, 0].AddController(clickEvent); SupplierGrid[r, 1] = new SourceGrid.Cells.Cell(item.Contact); SupplierGrid[r, 1].AddController(clickEvent); SupplierGrid[r, 2] = new SourceGrid.Cells.Cell(item.Remark); SupplierGrid[r, 2].AddController(clickEvent); SupplierGrid[r, 3] = new SourceGrid.Cells.Cell(item.Address); SupplierGrid[r, 3].AddController(clickEvent); SupplierGrid[r, 4] = new SourceGrid.Cells.Link("产品列表"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(CellButton_Click); SupplierGrid[r, 4].Controller.AddController(buttonClickEvent); r++; } SupplierGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void FillGridPallets(WCFClient wcfClient) { // initialize grid List <string> captions = new List <string> { string.Format(Properties.Resources.ID_DIMENSIONS, UnitsManager.UnitString(UnitsManager.UnitType.UT_LENGTH)), string.Format(Properties.Resources.ID_WEIGHT_WU, UnitsManager.UnitString(UnitsManager.UnitType.UT_MASS)) }; GridInitialize(gridPallets, captions); // handling delete event SourceGrid.Cells.Controllers.CustomEvents buttonDelete = new SourceGrid.Cells.Controllers.CustomEvents(); buttonDelete.Click += new EventHandler(OnDeleteItem); _pallets = wcfClient.Client.GetAllPalletsSearch(SearchString, SearchDescription, RangeIndex, ref _numberOfItems, false); int iIndex = 0; foreach (DCSBPallet p in _pallets) { UnitsManager.UnitSystem us = (UnitsManager.UnitSystem)p.UnitSystem; gridPallets.Rows.Insert(++iIndex); int iCol = 0; gridPallets[iIndex, iCol++] = new SourceGrid.Cells.Cell(p.Name); gridPallets[iIndex, iCol++] = new SourceGrid.Cells.Cell(p.Description); gridPallets[iIndex, iCol++] = new SourceGrid.Cells.Cell( string.Format("{0:0.##} x {1:0.##} x {2:0.##}", UnitsManager.ConvertLengthFrom(p.Dimensions.M0, us), UnitsManager.ConvertLengthFrom(p.Dimensions.M1, us), UnitsManager.ConvertLengthFrom(p.Dimensions.M2, us)) ); gridPallets[iIndex, iCol++] = new SourceGrid.Cells.Cell( string.Format("{0:0.###}", UnitsManager.ConvertMassFrom(p.Weight, us)) ); gridPallets[iIndex, iCol] = new SourceGrid.Cells.Button("") { Image = Properties.Resources.Delete }; gridPallets[iIndex, iCol++].AddController(buttonDelete); } GridFinalize(gridPallets); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 6; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CYLINDERCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETLIMIT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (HCylinderPalletSolution sol in _analysis.Solutions) { // build case count string string sCaseCount = string.Format("{0}", sol.CylinderCount); // insert row gridSolutions.Rows.Insert(++iIndex); // filling columns gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(sCaseCount); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletWeight)); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletHeight)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(PalletSolutionLimitToString(sol.LimitReached)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormalCheck; gridSolutions[iIndex, 5].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); graphCtrlSolution.Invalidate(); }
private void FillGrid() { // fill grid solutions gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 8; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYOUT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LOADWEIGHT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LOADHEIGHT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 7] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (TruckSolution sol in _truckAnalysis.Solutions) { ++iIndex; gridSolutions.Rows.Insert(iIndex); // index gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); // Layout { Graphics2DImage graphics = new Graphics2DImage(new Size(300, 30)); TruckSolutionViewer sv = new TruckSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } // Pallet count gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.PalletCount)); // Case count gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.BoxCount)); // Efficiency gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.Efficiency)); // Load gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.LoadWeight)); // Load height gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.LoadHeight)); // Selected gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _truckAnalysis.HasSolutionSelected(iIndex-1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormal; gridSolutions[iIndex, 7].View = viewNormalCheck; gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); if (_truckAnalysis.Solutions.Count > 0) _sol = _truckAnalysis.Solutions[0]; graphCtrlSolution.Invalidate(); }
public void DoFill(List<Order> list) { OrderGrid.Redim(0, 0); OrderGrid.FixedRows = 1; OrderGrid.FixedColumns = 1; OrderGrid.EnableSort = true; OrderGrid.Redim(list.Count + 1, 8); OrderGrid.Rows[0].Height = 25; OrderGrid[0, 0] = new MyHeader(""); OrderGrid[0, 0].Column.Width = 50; OrderGrid[0, 1] = new MyHeader("开始日期"); OrderGrid[0, 1].Column.Width = 100; OrderGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 2] = new MyHeader("结束日期"); OrderGrid[0, 2].Column.Width = 100; OrderGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 3] = new MyHeader("订单编号"); OrderGrid[0, 3].Column.Width = 100; OrderGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 4] = new MyHeader("订单描述"); OrderGrid[0, 4].Column.Width = 300; OrderGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 5] = new MyHeader("业务员"); OrderGrid[0, 5].Column.Width = 100; OrderGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 6] = new MyHeader("订单状态"); OrderGrid[0, 6].Column.Width = 150; OrderGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 7] = new MyHeader("备注"); OrderGrid[0, 7].Column.Width = 200; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); clickEvent.Click += new EventHandler(clickEvent_Click); int r = 1; foreach (Order order in list) { OrderGrid.Rows[r].Tag = order.Id; OrderGrid.Rows[r].Height = 25; if (string.IsNullOrEmpty(order.EndDate)) { OrderGrid[r, 0] = new SourceGrid.Cells.Button("跟进"); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(CellButton_Click); OrderGrid[r, 0].Controller.AddController(buttonClickEvent); } else { OrderGrid[r, 0] = null; } OrderGrid[r, 1] = new SourceGrid.Cells.Cell(order.BeginDate); OrderGrid[r, 1].AddController(clickEvent); OrderGrid[r, 2] = new SourceGrid.Cells.Cell(order.EndDate); OrderGrid[r, 2].AddController(clickEvent); OrderGrid[r, 3] = new SourceGrid.Cells.Cell(order.OrderNo); OrderGrid[r, 3].AddController(clickEvent); OrderGrid[r, 4] = new SourceGrid.Cells.Cell(order.Description); OrderGrid[r, 4].AddController(clickEvent); OrderGrid[r, 5] = new SourceGrid.Cells.Cell(order.SalesMan); OrderGrid[r, 6] = new SourceGrid.Cells.Cell(order.Status); OrderGrid[r, 7] = new SourceGrid.Cells.Cell(order.Remark); r++; } OrderGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEDIMENSIONS + @" (mm*mm*mm)"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEINSIDEDIMENSIONS + @" (mm*mm*mm)"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ORIENTATION); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents palletSolCheckBoxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); palletSolCheckBoxClickEvent.Click += new EventHandler(palletSolCheckBoxClickEvent_Click); int iIndex = 0; foreach (PalletSolutionDesc desc in PalletSolutionDatabase.Instance.QueryPalletSolutions(CurrentKey)) { gridSolutions.Rows.Insert(++iIndex); gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(GetBoxBitmapFromDesc(desc)); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(desc.FriendlyName); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseDimensionsString)); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseInsideDimensionsString)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseOrientation)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseCount)); bool selected = true; if (null != _caseAnalysis) selected = _caseAnalysis.PalletSolutionsList.Contains(desc); gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, selected); gridSolutions[iIndex, 6].AddController(palletSolCheckBoxClickEvent); } // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(-1, false); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 6; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEDIMENSIONS + @"(mm*mm*mm)"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEINSIDEDIMENSIONS + @"(mm*mm*mm)"); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ORIENTATION); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; int iIndex = 0; foreach (PalletSolutionDesc desc in PalletSolutionDatabase.Instance.QueryPalletSolutions(CurrentKey)) { gridSolutions.Rows.Insert(++iIndex); gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(desc.FriendlyName); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseDimensionsString)); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseInsideDimensionsString)); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseOrientation)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseCount)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Button(""); gridSolutions[iIndex, 5].Image = Properties.Resources.Delete; SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(DeleteButton_Click); gridSolutions[iIndex, 5].Controller.AddController(buttonClickEvent); } // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution if (gridSolutions.RowsCount > 1) { gridSolutions.Selection.SelectRow(1, true); } Draw(); }
private void FillGrid() { // remove all existing rows grid.Rows.Clear(); // *** IViews // caption header var captionHeader = new SourceGrid.Cells.Views.RowHeader() { Background = new DevAge.Drawing.VisualElements.RowHeader() { BackColor = Color.SteelBlue, Border = DevAge.Drawing.RectangleBorder.NoBorder }, ForeColor = Color.Black, Font = new Font("Arial", 10, FontStyle.Bold), TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter }; // view column header var viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader() { Background = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }, ForeColor = Color.Black, Font = new Font("Arial", 10, FontStyle.Regular), }; viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // set first row grid.BorderStyle = BorderStyle.FixedSingle; grid.ColumnsCount = 8; grid.FixedRows = 1; grid.Rows.Insert(0); // header int iCol = 0; SourceGrid.Cells.ColumnHeader columnHeader; // name columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // profile columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_PROFILE) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // thickness columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_THICKNESS) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // ECT columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ECT) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // RigidityX columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_RIGIDITYX) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // RigidityY columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_RIGIDITYY) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // edit columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EDIT) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // delete columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_DELETE) { AutomaticSortEnabled = false, View = viewColumnHeader }; grid[0, iCol++] = columnHeader; // handling delete event SourceGrid.Cells.Controllers.CustomEvents buttonDelete = new SourceGrid.Cells.Controllers.CustomEvents(); buttonDelete.Click += new EventHandler(OnDeleteItem); SourceGrid.Cells.Controllers.CustomEvents buttonEdit = new SourceGrid.Cells.Controllers.CustomEvents(); buttonEdit.Click += new EventHandler(OnEditItem); // ROWS int iIndex = 0; var dictQuality = CardboardQualityAccessor.Instance.CardboardQualities; foreach (var q in dictQuality) { grid.Rows.Insert(++iIndex); iCol = 0; var quality = q; grid[iIndex, iCol++] = new SourceGrid.Cells.Cell(quality.Name); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell(quality.Profile); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.Thickness:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.ECT:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.RigidityDX:0.##}"); grid[iIndex, iCol++] = new SourceGrid.Cells.Cell($"{quality.RigidityDY:0.##}"); grid[iIndex, iCol] = new SourceGrid.Cells.Button(Properties.Resources.ID_EDIT); grid[iIndex, iCol++].AddController(buttonEdit); grid[iIndex, iCol] = new SourceGrid.Cells.Button("") { Image = Properties.Resources.Delete }; grid[iIndex, iCol++].AddController(buttonDelete); } grid.AutoStretchColumnsToFitWidth = true; grid.AutoSizeCells(); grid.Columns.StretchToFit(); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 8; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PACKCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CONSUMERSALESUNITS); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; columnHeader.SortComparer = new SourceGrid.MultiColumnsComparer(); gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_LAYERWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_MAXIMUMSPACE, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 7] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (PackPalletSolution sol in _analysis.Solutions) { // build case count string string sPackCount = string.Format("{0}\n({1} * {2})", sol.PackCount, sol.PackPerLayer, sol.LayerCount); string sCSUCount = string.Format("{0}", sol.CSUCount); // insert row gridSolutions.Rows.Insert(++iIndex); gridSolutions.Rows[iIndex].Tag = sol; // filling columns { Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50)); PackPalletSolutionViewer sv = new PackPalletSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(graphics.Bitmap); } gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(sPackCount); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sCSUCount); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(Math.Round(sol.LayerWeight, 3)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletWeight, 3)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletHeight, 1)); gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(Math.Round(sol.MaximumSpace, 1)); gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormal; gridSolutions[iIndex, 7].View = viewNormalCheck; gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); graphCtrlSolution.Invalidate(); }
public void DoFill(int GroupId, List<AliProduct> list) { ProductGrid.Redim(0, 0); ProductGrid.FixedRows = 1; ProductGrid.EnableSort = true; ProductGrid.Redim(list.Count + 1, 8); ProductGrid.Rows[0].Height = 25; ProductGrid[0, 0] = new MyHeader("图片"); ProductGrid[0, 0].Column.Width = 50; ProductGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 1] = new MyHeader("产品名称"); ProductGrid[0, 1].Column.Width = 350; ProductGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 2] = new MyHeader("型号"); ProductGrid[0, 2].Column.Width = 120; ProductGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 3] = new MyHeader("橱窗产品"); ProductGrid[0, 3].Column.Width = 80; ProductGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 4] = new MyHeader("关键词"); ProductGrid[0, 4].Column.Width = 150; ProductGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 5] = new MyHeader("产品状态"); ProductGrid[0, 5].Column.Width = 70; ProductGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 6] = new MyHeader("所属成员"); ProductGrid[0, 6].Column.Width = 100; ProductGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); ProductGrid[0, 7] = new MyHeader("更新时间"); ProductGrid[0, 7].Column.Width = 100; ProductGrid[0, 7].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); int r = 1; foreach (AliProduct item in list) { string imageFile = FileUtils.GetProductImagesFolder() + Path.DirectorySeparatorChar + item.Id + ".jpg"; Image image = ImageUtils.ResizeImage(imageFile, 50, 50); ProductGrid.Rows[r].Tag = item.Id; ProductGrid.Rows[r].Height = 50; ProductGrid[r, 0] = new SourceGrid.Cells.Image(image); ProductGrid[r, 0].AddController(clickEvent); ProductGrid[r, 1] = new SourceGrid.Cells.Cell(item.Subject); ProductGrid[r, 1].AddController(clickEvent); ProductGrid[r, 2] = new SourceGrid.Cells.Cell(item.RedModel); ProductGrid[r, 2].AddController(clickEvent); ProductGrid[r, 3] = new SourceGrid.Cells.Cell(item.IsWindowProduct?"是":""); ProductGrid[r, 3].AddController(clickEvent); ProductGrid[r, 4] = new SourceGrid.Cells.Cell(item.Keywords.Replace(",","\r\n")); ProductGrid[r, 4].AddController(clickEvent); ProductGrid[r, 5] = new SourceGrid.Cells.Cell(item.Status); ProductGrid[r, 5].AddController(clickEvent); ProductGrid[r, 6] = new SourceGrid.Cells.Cell(item.OwnerMemberName); ProductGrid[r, 6].AddController(clickEvent); ProductGrid[r, 7] = new SourceGrid.Cells.Cell(item.GmtModified); ProductGrid[r, 7].AddController(clickEvent); if (!File.Exists(imageFile)) { ThreadPool.QueueUserWorkItem(new WaitCallback(LoadingProductImage), new object[] { item, r, GroupId }); } r++; } ProductGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void FillGrid() { // fill grid solutions gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 8; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYOUT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LOADWEIGHT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LOADHEIGHT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 7] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (TruckSolution sol in _truckAnalysis.Solutions) { ++iIndex; gridSolutions.Rows.Insert(iIndex); // index gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); // Layout { Graphics2DImage graphics = new Graphics2DImage(new Size(300, 30)); TruckSolutionViewer sv = new TruckSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } // Pallet count gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.PalletCount)); // Case count gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", sol.BoxCount)); // Efficiency gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.Efficiency)); // Load gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.LoadWeight)); // Load height gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.LoadHeight)); // Selected gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _truckAnalysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormal; gridSolutions[iIndex, 7].View = viewNormalCheck; gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); if (_truckAnalysis.Solutions.Count > 0) { _sol = _truckAnalysis.Solutions[0]; } graphCtrlSolution.Invalidate(); }
public void DoFill(List<Finance> list) { int rowCount = 3; foreach (Finance finance in list) { rowCount = rowCount + finance.Details.Count; } FinGrid.Redim(0, 0); FinGrid.FixedRows = 2; FinGrid.FixedColumns = 3; FinGrid.EnableSort = true; FinGrid.Redim(rowCount, 15); FinGrid[0, 0] = new MyHeader("日期"); FinGrid[0, 0].RowSpan = 2; FinGrid[0, 0].Column.Width = 100; FinGrid[0, 1] = new MyHeader("收支类型"); FinGrid[0, 1].RowSpan = 2; FinGrid[0, 1].Column.Width = 70; FinGrid[0, 2] = new MyHeader("款项描述"); FinGrid[0, 2].RowSpan = 2; FinGrid[0, 2].Column.Width = 250; FinGrid[0, 3] = new MyHeader("金额"); FinGrid[0, 3].RowSpan = 2; FinGrid[0, 3].Column.Width = 100; FinGrid[0, 4] = new MyHeader("汇率"); FinGrid[0, 4].RowSpan = 2; FinGrid[0, 4].Column.Width = 100; FinGrid[0, 5] = new MyHeader("总金额"); FinGrid[0, 5].RowSpan = 2; FinGrid[0, 5].Column.Width = 150; FinGrid[0, 6] = new MyHeader("流水号"); FinGrid[0, 6].RowSpan = 2; FinGrid[0, 6].Column.Width = 100; FinGrid[0, 7] = new MyHeader("收付款单位"); FinGrid[0, 7].RowSpan = 2; FinGrid[0, 7].Column.Width = 100; FinGrid[0, 8] = new MyHeader("经手人/相关人"); FinGrid[0, 8].RowSpan = 2; FinGrid[0, 8].Column.Width = 100; FinGrid[0, 9] = new MyHeader("备注"); FinGrid[0, 9].RowSpan = 2; FinGrid[0, 9].Column.Width = 150; FinGrid[0, 10] = new MyHeader("明细"); FinGrid[0, 10].ColumnSpan = 5; FinGrid[1, 10] = new MyHeader("描述"); FinGrid[1, 10].Column.Width = 200; FinGrid[1, 11] = new MyHeader("所属业务"); FinGrid[1, 11].Column.Width = 100; FinGrid[1, 12] = new MyHeader("金额"); FinGrid[1, 12].Column.Width = 150; FinGrid[1, 13] = new MyHeader("总金额"); FinGrid[1, 13].Column.Width = 150; FinGrid[1, 14] = new MyHeader("备注"); FinGrid[1, 14].Column.Width = 300; SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(clickEvent_Click); SourceGrid.Cells.Views.Cell view; int r = 2; double SumTotalAmount = 0.0; double DetailSumTotalAmount = 0.0; foreach (Finance finance in list) { int detailCount = finance.Details.Count(); FinGrid.Rows[r].Height = 22; FinGrid[r, 0] = new SourceGrid.Cells.Cell(finance.FinDate); FinGrid[r, 0].AddController(clickEvent); FinGrid[r, 1] = new SourceGrid.Cells.Cell(finance.EventType); FinGrid[r, 1].AddController(clickEvent); FinGrid[r, 2] = new SourceGrid.Cells.Cell(finance.Description); FinGrid[r, 2].AddController(clickEvent); string amount = "(" + finance.Currency + ")" + finance.Amount.ToString("#,##0.00"); FinGrid[r, 3] = new SourceGrid.Cells.Cell(amount); FinGrid[r, 3].AddController(clickEvent); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 3].View = view; string rate = finance.Rate.ToString("#,##0.0000"); FinGrid[r, 4] = new SourceGrid.Cells.Cell(rate); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; FinGrid[r, 4].View = view; string totalAmount= "¥" + finance.TotalAmount.ToString("#,##0.00"); SumTotalAmount = SumTotalAmount + finance.TotalAmount; FinGrid[r, 5] = new SourceGrid.Cells.Cell(totalAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 5].View = view; FinGrid[r, 6] = new SourceGrid.Cells.Cell(finance.ReferenceNo); FinGrid[r, 7] = new SourceGrid.Cells.Cell(finance.ReceivePaymentor); FinGrid[r, 8] = new SourceGrid.Cells.Cell(finance.Association); FinGrid[r, 9] = new SourceGrid.Cells.Cell(finance.Remark); FinGrid[r, 0].RowSpan = detailCount; FinGrid[r, 1].RowSpan = detailCount; FinGrid[r, 2].RowSpan = detailCount; FinGrid[r, 3].RowSpan = detailCount; FinGrid[r, 4].RowSpan = detailCount; FinGrid[r, 5].RowSpan = detailCount; FinGrid[r, 6].RowSpan = detailCount; FinGrid[r, 7].RowSpan = detailCount; FinGrid[r, 8].RowSpan = detailCount; FinGrid[r, 9].RowSpan = detailCount; foreach (FinDetails detail in finance.Details) { FinGrid.Rows[r].Tag = finance.FinId; FinGrid.Rows[r].Height = 22; FinGrid[r, 10] = new SourceGrid.Cells.Cell(detail.Description); FinGrid[r, 11] = new SourceGrid.Cells.Cell(detail.OrderNo); string detailAmount = "(" + finance.Currency + ")" + detail.Amount.ToString("#,##0.00"); FinGrid[r, 12] = new SourceGrid.Cells.Cell(detailAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 12].View = view; string detailTotalAmount = "¥" + detail.TotalAmount.ToString("#,##0.00"); DetailSumTotalAmount = DetailSumTotalAmount + detail.TotalAmount; FinGrid[r, 13] = new SourceGrid.Cells.Cell(detailTotalAmount); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(finance.TotalAmount); FinGrid[r, 13].View = view; FinGrid[r, 14] = new SourceGrid.Cells.Cell(detail.Remark); r++; } } for (int i = 0; i < 15; i++) { FinGrid[r, i] = new SourceGrid.Cells.Cell(""); } FinGrid.Rows[r].Height = 22; FinGrid[r, 2] = new SourceGrid.Cells.Cell("合计"); FinGrid[r, 5] = new SourceGrid.Cells.Cell("¥" + SumTotalAmount.ToString("#,##0.00")); FinGrid[r, 13] = new SourceGrid.Cells.Cell("¥" + DetailSumTotalAmount.ToString("#,##0.00")); view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(SumTotalAmount); FinGrid[r, 5].View = FinGrid[r, 13].View = view; FinGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.Redim(20, 10); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r = r + 2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r + 1, 0] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(r), typeof(DateTime)); grid1[r + 1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; } grid1.AutoSizeCells(); }
private void FillGrid() { // fill grid solutions gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; // index columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; // layers columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_LAYERPATTERNS); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; // case dimensions columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; // box / case count columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_BOXCASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; // efficiency columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EFFICIENCYPERCENTAGE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; // weights columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_WEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; // selected columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (BoxCasePalletSolution sol in _caseAnalysis.Solutions) { if (null == sol.PalletSolutionDesc.LoadPalletSolution()) continue; // insert new row gridSolutions.Rows.Insert(++iIndex); // # (index) gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); { Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50)); BoxCasePalletSolutionViewer sv = new BoxCasePalletSolutionViewer(sol); sv.Draw(graphics); // layers gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } // case dimensions gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0}\n({1:0.#}*{2:0.#}*{3:0.#})", sol.PalletSolutionDesc.FriendlyName, sol.CaseLength, sol.CaseWidth, sol.CaseHeight)); // box / case count gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("Boxes/case: {0}\nCases/pallet: {1}\nBoxes/pallet:{2}", sol.BoxPerCaseCount, sol.CasePerPalletCount, sol.BoxPerPalletCount)); // efficiency gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseEfficiency, sol.PalletEfficiency)); // weights gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseWeight, sol.PalletWeight)); // selected gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, _caseAnalysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormalCheck; gridSolutions[iIndex, 6].AddController(solCheckboxClickEvent); } try { gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); } catch (Exception /*ex*/) { } // select first solution gridSolutions.Selection.SelectRow(1, true); // draw graphCtrlCaseSolution.Invalidate(); graphCtrlPalletSolution.Invalidate(); }
private void FillGrid() { // fill grid solutions gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; // index columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; // layers columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_LAYERPATTERNS); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; // case dimensions columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; // box / case count columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_BOXCASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; // efficiency columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_EFFICIENCYPERCENTAGE); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; // weights columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Properties.Resources.ID_WEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; // selected columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (BoxCasePalletSolution sol in _caseAnalysis.Solutions) { if (null == sol.PalletSolutionDesc.LoadPalletSolution()) { continue; } // insert new row gridSolutions.Rows.Insert(++iIndex); // # (index) gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); { Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50)); BoxCasePalletSolutionViewer sv = new BoxCasePalletSolutionViewer(sol); sv.Draw(graphics); // layers gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } // case dimensions gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "{0}\n({1:0.#}*{2:0.#}*{3:0.#})", sol.PalletSolutionDesc.FriendlyName, sol.CaseLength, sol.CaseWidth, sol.CaseHeight)); // box / case count gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("Boxes/case: {0}\nCases/pallet: {1}\nBoxes/pallet:{2}", sol.BoxPerCaseCount, sol.CasePerPalletCount, sol.BoxPerPalletCount)); // efficiency gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseEfficiency, sol.PalletEfficiency)); // weights gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format(CultureInfo.InvariantCulture, "Case :{0:0.#}\nPallet :{1:0.#}", sol.CaseWeight, sol.PalletWeight)); // selected gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, _caseAnalysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormalCheck; gridSolutions[iIndex, 6].AddController(solCheckboxClickEvent); } try { gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); } catch (Exception /*ex*/) { } // select first solution gridSolutions.Selection.SelectRow(1, true); // draw graphCtrlCaseSolution.Invalidate(); graphCtrlPalletSolution.Invalidate(); }
public void DoFill(List<Order> list) { OrderGrid.Redim(0, 0); OrderGrid.FixedRows = 1; OrderGrid.EnableSort = true; int RowNum = IsFinOrderView ? list.Count + 2 : list.Count + 1; OrderGrid.Redim(RowNum, 7); OrderGrid.Rows[0].Height = 25; OrderGrid[0, 0] = new MyHeader("开始日期"); OrderGrid[0, 0].Column.Width = 100; OrderGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 1] = new MyHeader("结束日期"); OrderGrid[0, 1].Column.Width = 100; OrderGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 2] = new MyHeader("订单编号"); OrderGrid[0, 2].Column.Width = 100; OrderGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 3] = new MyHeader("订单描述"); OrderGrid[0, 3].Column.Width = 300; OrderGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 4] = new MyHeader("业务员"); OrderGrid[0, 4].Column.Width = 100; OrderGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); OrderGrid[0, 5] = new MyHeader("订单状态"); OrderGrid[0, 5].Column.Width = 150; OrderGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); if (!IsFinOrderView) { OrderGrid[0, 6] = new MyHeader("备注"); OrderGrid[0, 6].Column.Width = 200; } else { OrderGrid[0, 6] = new MyHeader("业务总金额"); OrderGrid[0, 6].Column.Width = 150; OrderGrid[0, 6].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); } SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(clickEvent_Click); int r = 1; double TotalAmount = 0; foreach (Order order in list) { OrderGrid.Rows[r].Tag = order.Id; OrderGrid.Rows[r].Height = 25; OrderGrid[r, 0] = new SourceGrid.Cells.Cell(order.BeginDate); OrderGrid[r, 0].AddController(clickEvent); OrderGrid[r, 1] = new SourceGrid.Cells.Cell(order.EndDate); OrderGrid[r, 1].AddController(clickEvent); OrderGrid[r, 2] = new SourceGrid.Cells.Cell(order.OrderNo); OrderGrid[r, 2].AddController(clickEvent); OrderGrid[r, 3] = new SourceGrid.Cells.Cell(order.Description); OrderGrid[r, 3].AddController(clickEvent); OrderGrid[r, 4] = new SourceGrid.Cells.Cell(order.SalesMan); OrderGrid[r, 5] = new SourceGrid.Cells.Cell(order.Status); if (!IsFinOrderView) { OrderGrid[r, 6] = new SourceGrid.Cells.Cell(order.Remark); } else { TotalAmount = TotalAmount + order.TotalAmount; string totalAmount = "¥" + order.TotalAmount.ToString("#,##0.00"); OrderGrid[r, 6] = new SourceGrid.Cells.Cell(totalAmount); SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(order.TotalAmount); OrderGrid[r, 6].View = view; } r++; } if (IsFinOrderView) { for (int i = 0; i < 6; i++) { OrderGrid[r, i] = new SourceGrid.Cells.Cell(""); } OrderGrid[r, 3] = new SourceGrid.Cells.Cell("合计"); OrderGrid[r, 6] = new SourceGrid.Cells.Cell("¥" + TotalAmount.ToString("#,##0.00")); SourceGrid.Cells.Views.Cell view = new SourceGrid.Cells.Views.Cell(); view.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; view.ForeColor = FileUtils.GetColor(TotalAmount); OrderGrid[r, 6].View = view; } OrderGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
public void DoFill(List<Product> list) { MyItemGrid.Redim(0, 0); MyItemGrid.FixedRows = 1; MyItemGrid.FixedColumns = 1; MyItemGrid.EnableSort = true; MyItemGrid.Redim(list.Count + 1, 6); MyItemGrid.Rows[0].Height = 25; MyItemGrid[0, 0] = new MyHeader("图片"); MyItemGrid[0, 0].Column.Width = 80; MyItemGrid[0, 1] = new MyHeader("名称标题"); MyItemGrid[0, 1].Column.Width = MyItemGrid.Width - 460; MyItemGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 2] = new MyHeader("型号"); MyItemGrid[0, 2].Column.Width = 100; MyItemGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 3] = new MyHeader("价格"); MyItemGrid[0, 3].Column.Width = 100; MyItemGrid[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 4] = new MyHeader("最小订量"); MyItemGrid[0, 4].Column.Width = 100; MyItemGrid[0, 4].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); MyItemGrid[0, 5] = new MyHeader("状态"); MyItemGrid[0, 5].Column.Width = 80; MyItemGrid[0, 5].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.DoubleClick += new EventHandler(dbClickEvent_Click); int r = 1; foreach (Product item in list) { MyItemGrid.Rows[r].Tag = item.Id; MyItemGrid.Rows[r].Height = 80; Image image = AliHelper.Properties.Resources.no_image; if (item.Image != null) { ThreadPool.QueueUserWorkItem(new WaitCallback(LoadingProductImage), new object[] { item, r, SelectedCategory.Id }); } MyItemGrid[r, 0] = new SourceGrid.Cells.Image(image); MyItemGrid[r, 0].AddController(clickEvent); MyItemGrid[r, 1] = new SourceGrid.Cells.Cell(item.Name); MyItemGrid[r, 1].AddController(clickEvent); MyItemGrid[r, 2] = new SourceGrid.Cells.Cell(item.Model); MyItemGrid[r, 2].AddController(clickEvent); MyItemGrid[r, 3] = new SourceGrid.Cells.Cell(item.Price.ToString("#,##0.00")); MyItemGrid[r, 3].AddController(clickEvent); MyItemGrid[r, 4] = new SourceGrid.Cells.Cell(item.Minimum +"PCS"); MyItemGrid[r, 4].AddController(clickEvent); string status = item.Status == "A" ? "有效" : "无效"; MyItemGrid[r, 5] = new SourceGrid.Cells.Cell(status); MyItemGrid[r, 5].AddController(clickEvent); r++; } MyItemGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }
private void FillGrid() { // fill grid solutions gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_BOXCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASEWEIGHT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASELIMIT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (BoxCaseSolution sol in _analysis.Solutions) { // build case count string string sBoxCount = string.Empty; sBoxCount = string.Format("{0}\n({1} * {2})", sol.BoxPerCaseCount, sol.BoxPerLayerCount, sol.Count); // insert row gridSolutions.Rows.Insert(++iIndex); // filling columns gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); { Graphics2DImage graphics = new Graphics2DImage(new Size(50, 50)); BoxCaseSolutionViewer sv = new BoxCaseSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sBoxCount); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.VolumeEfficiencyBoxes)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.CaseWeight)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(BoxCaseSolutionLimitToString(sol.LimitReached)); gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 6].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); // redraw graphCtrlSolution.Invalidate(); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White) { Border = cellBorder }; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White) { Border = cellBorder }; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader() { BackColor = Color.LightGray, Border = DevAge.Drawing.RectangleBorder.NoBorder }; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 7; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASE) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEDIMENSIONS + @" (mm*mm*mm)") { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASEINSIDEDIMENSIONS + @" (mm*mm*mm)") { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_ORIENTATION) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_CASECOUNT) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_SELECTED) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridSolutions[0, 6] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents palletSolCheckBoxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); palletSolCheckBoxClickEvent.Click += new EventHandler(palletSolCheckBoxClickEvent_Click); int iIndex = 0; foreach (PalletSolutionDesc desc in PalletSolutionDatabase.Instance.QueryPalletSolutions(CurrentKey)) { gridSolutions.Rows.Insert(++iIndex); gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(GetBoxBitmapFromDesc(desc)); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(desc.FriendlyName); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseDimensionsString)); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseInsideDimensionsString)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseOrientation)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0}", desc.CaseCount)); bool selected = true; if (null != _caseAnalysis) { selected = _caseAnalysis.PalletSolutionsList.Contains(desc); } gridSolutions[iIndex, 6] = new SourceGrid.Cells.CheckBox(null, selected); gridSolutions[iIndex, 6].AddController(palletSolCheckBoxClickEvent); } // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(-1, false); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 8; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_INDEX); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CASECOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_VOLUMEEFFICIENCY); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PALLETLIMIT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 7] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (CylinderPalletSolution sol in _analysis.Solutions) { // build case count string string sCaseCount = string.Empty; if (sol.HasSameCountLayers && sol.LimitReached == Limit.LIMIT_MAXHEIGHTREACHED) { sCaseCount = string.Format("{0}\n({1} * {2})", sol.CylinderCount, sol.CylinderPerLayerCount, sol.CylinderLayersCount); } else { sCaseCount = string.Format("{0}", sol.CylinderCount); } // insert row gridSolutions.Rows.Insert(++iIndex); // filling columns gridSolutions[iIndex, 0] = new SourceGrid.Cells.Cell(string.Format("{0}", iIndex)); { Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50)); CylinderPalletSolutionViewer sv = new CylinderPalletSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 1] = new SourceGrid.Cells.Image(graphics.Bitmap); } gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sCaseCount); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.VolumeEfficiency)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletWeight)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(string.Format("{0:F}", sol.PalletHeight)); gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(PalletSolutionLimitToString(sol.LimitReached)); gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormal; gridSolutions[iIndex, 7].View = viewNormalCheck; gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); graphCtrlSolution.Invalidate(); }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.Redim(20, 10); grid1.FixedRows = 2; //1 Header Row grid1[0, 0] = new MyHeader("3 Column Header"); grid1[0, 0].ColumnSpan = 3; grid1[0, 3] = new MyHeader("5 Column Header"); grid1[0, 3].ColumnSpan = 5; grid1[0, 8] = new MyHeader("1 Column Header"); grid1[0, 9] = new MyHeader("1 Column Header"); //2 Header Row grid1[1, 0] = new MyHeader("1"); grid1[1, 1] = new MyHeader("2"); grid1[1, 2] = new MyHeader("3"); grid1[1, 3] = new MyHeader("4"); grid1[1, 4] = new MyHeader("5"); grid1[1, 5] = new MyHeader("6"); grid1[1, 6] = new MyHeader("7"); grid1[1, 7] = new MyHeader("8"); grid1[1, 8] = new MyHeader("9"); grid1[1, 9] = new MyHeader("10"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Controllers.CustomEvents clickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); clickEvent.Click += new EventHandler(clickEvent_Click); for (int r = 2; r < grid1.RowsCount; r=r+2) { grid1[r, 0] = new SourceGrid.Cells.Cell(r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r+1, 0] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(r), typeof(DateTime)); grid1[r+1, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span", false); grid1[r, 2].ColumnSpan = 2; grid1[r, 2].RowSpan = 2; grid1[r, 4] = new SourceGrid.Cells.Link("Link Column/Row Span"); grid1[r, 4].ColumnSpan = 2; grid1[r, 4].RowSpan = 2; grid1[r, 4].AddController(clickEvent); grid1[r, 6] = new SourceGrid.Cells.Button("Button Column/Row Span"); grid1[r, 6].ColumnSpan = 2; grid1[r, 6].RowSpan = 2; grid1[r, 6].AddController(clickEvent); grid1[r, 8] = new SourceGrid.Cells.Cell("Image Column/Row Span"); grid1[r, 8].View = viewImage; grid1[r, 8].Image = Properties.Resources.FACE02.ToBitmap(); grid1[r, 8].ColumnSpan = 2; grid1[r, 8].RowSpan = 2; } grid1.AutoSizeCells(); }
private void FillGrid() { // fill grid solution gridSolutions.Rows.Clear(); // border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkBlue, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); // views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); viewNormal.Border = cellBorder; CheckboxBackColorAlternate viewNormalCheck = new CheckboxBackColorAlternate(Color.LightBlue, Color.White); viewNormalCheck.Border = cellBorder; // column header view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.LightGray; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Arial", 10, FontStyle.Bold); viewColumnHeader.ElementSort.SortStyle = DevAge.Drawing.HeaderSortStyle.None; // create the grid gridSolutions.BorderStyle = BorderStyle.FixedSingle; gridSolutions.ColumnsCount = 8; gridSolutions.FixedRows = 1; gridSolutions.Rows.Insert(0); // header SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_LAYERPATTERN); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_PACKCOUNT); columnHeader.AutomaticSortEnabled = false; columnHeader.View = viewColumnHeader; gridSolutions[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_CONSUMERSALESUNITS); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; columnHeader.SortComparer = new SourceGrid.MultiColumnsComparer(); gridSolutions[0, 2] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_LAYERWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 3] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETWEIGHT, UnitsManager.MassUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 4] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_PALLETHEIGHT, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 5] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(string.Format(Resources.ID_MAXIMUMSPACE, UnitsManager.LengthUnitString)); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 6] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader(Resources.ID_SELECTED); columnHeader.AutomaticSortEnabled = true; columnHeader.View = viewColumnHeader; gridSolutions[0, 7] = columnHeader; // handling check box click SourceGrid.Cells.Controllers.CustomEvents solCheckboxClickEvent = new SourceGrid.Cells.Controllers.CustomEvents(); solCheckboxClickEvent.Click += new EventHandler(clickEvent_Click); // data rows int iIndex = 0; foreach (PackPalletSolution sol in _analysis.Solutions) { // build case count string string sPackCount = string.Format("{0}\n({1} * {2})", sol.PackCount, sol.PackPerLayer, sol.LayerCount); string sCSUCount = string.Format("{0}", sol.CSUCount); // insert row gridSolutions.Rows.Insert(++iIndex); gridSolutions.Rows[iIndex].Tag = sol; // filling columns { Graphics2DImage graphics = new Graphics2DImage(new Size(100, 50)); PackPalletSolutionViewer sv = new PackPalletSolutionViewer(sol); sv.Draw(graphics); gridSolutions[iIndex, 0] = new SourceGrid.Cells.Image(graphics.Bitmap); } gridSolutions[iIndex, 1] = new SourceGrid.Cells.Cell(sPackCount); gridSolutions[iIndex, 2] = new SourceGrid.Cells.Cell(sCSUCount); gridSolutions[iIndex, 3] = new SourceGrid.Cells.Cell(Math.Round(sol.LayerWeight, 3)); gridSolutions[iIndex, 4] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletWeight, 3)); gridSolutions[iIndex, 5] = new SourceGrid.Cells.Cell(Math.Round(sol.PalletHeight, 1)); gridSolutions[iIndex, 6] = new SourceGrid.Cells.Cell(Math.Round(sol.MaximumSpace, 1)); gridSolutions[iIndex, 7] = new SourceGrid.Cells.CheckBox(null, _analysis.HasSolutionSelected(iIndex - 1)); gridSolutions[iIndex, 0].View = viewNormal; gridSolutions[iIndex, 1].View = viewNormal; gridSolutions[iIndex, 2].View = viewNormal; gridSolutions[iIndex, 3].View = viewNormal; gridSolutions[iIndex, 4].View = viewNormal; gridSolutions[iIndex, 5].View = viewNormal; gridSolutions[iIndex, 6].View = viewNormal; gridSolutions[iIndex, 7].View = viewNormalCheck; gridSolutions[iIndex, 7].AddController(solCheckboxClickEvent); } gridSolutions.AutoStretchColumnsToFitWidth = true; gridSolutions.AutoSizeCells(); gridSolutions.Columns.StretchToFit(); // select first solution gridSolutions.Selection.SelectRow(1, true); graphCtrlSolution.Invalidate(); }
public void DoFillTracking(List<OrderTracking> list) { TrackGrid.Redim(0, 0); TrackGrid.FixedRows = 1; TrackGrid.EnableSort = true; TrackGrid.Redim(list.Count + 1, 4); TrackGrid.Rows[0].Height = 25; TrackGrid[0, 0] = new MyHeader("跟踪日期"); TrackGrid[0, 0].Column.Width = 100; TrackGrid[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 1] = new MyHeader("描述"); TrackGrid[0, 1].Column.Width = 650; TrackGrid[0, 1].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 2] = new MyHeader("状态"); TrackGrid[0, 2].Column.Width = 150; TrackGrid[0, 2].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); TrackGrid[0, 3] = new MyHeader("跟踪人"); TrackGrid[0, 3].Column.Width = 100; SourceGrid.Cells.Controllers.CustomEvents trackEvents = new SourceGrid.Cells.Controllers.CustomEvents(); trackEvents.DoubleClick += new EventHandler(trackEvent_Click); int r = 1; foreach (OrderTracking tracking in list) { TrackGrid.Rows[r].Tag = tracking.Id; TrackGrid.Rows[r].Height = 25; TrackGrid[r, 0] = new SourceGrid.Cells.Cell(tracking.TrackingDate); TrackGrid[r, 0].AddController(trackEvents); TrackGrid[r, 1] = new SourceGrid.Cells.Cell(tracking.Description); TrackGrid[r, 1].AddController(trackEvents); TrackGrid[r, 2] = new SourceGrid.Cells.Cell(tracking.Status); TrackGrid[r, 2].AddController(trackEvents); TrackGrid[r, 3] = new SourceGrid.Cells.Cell(tracking.Tracker); TrackGrid[r, 3].AddController(trackEvents); r++; } TrackGrid.ClipboardMode = SourceGrid.ClipboardMode.All; }