private void setDefaultGrid(AxFPUSpreadADO.AxfpSpread arg_grid) { // Set Default Grid arg_grid.Visible = false; arg_grid.Reset(); arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone; arg_grid.DisplayColHeaders = false; arg_grid.DisplayRowHeaders = false; arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff; arg_grid.GrayAreaBackColor = Color.White; // arg_grid.ScrollBarExtMode = true; arg_grid.ColHeaderRows = 0; arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsHorizontal; arg_grid.Font = new System.Drawing.Font("Calibri", 11); arg_grid.set_RowHeight(1, 0.5); arg_grid.set_ColWidth(1, 0.5); arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter; arg_grid.TypeEditMultiLine = true; arg_grid.SetCellBorder(1, 1, 150, arg_grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); arg_grid.SetCellBorder(1, 1, 150, arg_grid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); for (int ic = 2; ic <= 150; ic++) { arg_grid.set_ColWidth(ic, 4.2); } }
public void MachineBodyTop(int arg_icol, int arg_irow, int arg_idt, DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { try { arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); // arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol + 1, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.SetCellBorder(arg_icol, arg_irow, arg_icol, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); arg_grid.set_RowHeight(arg_irow, _iHeight); arg_grid.Col = arg_icol; arg_grid.Row = arg_irow; arg_grid.Text = arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().Replace("/", "/\n"); if (arg_dt.Rows[arg_idt]["USE_YN"].ToString() == "N") { arg_grid.BackColor = Color.LightGray; iNoUse++; //_dtColor.Rows[row_index][column_index] = "5"; } else if (arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString() == "" || arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().ToUpper() == "NO PLAN") { if (arg_dt.Rows[arg_idt]["PLAN_FIX_YN"].ToString() == "Y") { arg_grid.BackColor = Color.LightCyan; // _dtColor.Rows[row_index][column_index] = "8"; } else { arg_grid.BackColor = Color.Red; iNoPlan++; //_dtColor.Rows[row_index][column_index] = "4"; } } else if (arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString().Split('/').Length > 1) { arg_grid.BackColor = Color.Yellow; arg_grid.ForeColor = Color.Black; iMoldChange++; iPlan++; //_dtColor.Rows[row_index][column_index] = "6"; } else { arg_grid.BackColor = Color.FromArgb(0, 255, 0); iPlan++; //_dtColor.Rows[row_index][column_index] = "3"; } } catch (Exception) {} }
public void MachineBody(int arg_icol, int arg_irow, int arg_idt, DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { try { arg_grid.SetCellBorder(arg_icol + 1, arg_irow, arg_icol + 2, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.SetCellBorder(arg_icol + 3, arg_irow, arg_icol + 3, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.SetCellBorder(arg_icol + 1, arg_irow, arg_icol + 2, arg_irow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.set_RowHeight(arg_irow, 20); arg_grid.Col = arg_icol; arg_grid.Row = arg_irow; arg_grid.Text = arg_dt.Rows[arg_idt]["MACHINE_NAME"].ToString(); arg_grid.FontSize = 11; arg_grid.FontBold = true; arg_grid.BackColor = Color.LightGreen; ///Plan arg_grid.Col = arg_icol + 1; arg_grid.Text = arg_dt.Rows[arg_idt]["MOLD_SIZE_CD"].ToString(); if (arg_dt.Rows[arg_idt]["STATUS"].ToString() == "1") { arg_grid.BackColor = Color.Yellow; } else { arg_grid.BackColor = Color.White; } ///Act arg_grid.Col = arg_icol + 2; arg_grid.Text = arg_dt.Rows[arg_idt]["ACTUAL"].ToString(); if (arg_dt.Rows[arg_idt]["STATUS"].ToString() == "1") { arg_grid.BackColor = Color.Yellow; } else { arg_grid.BackColor = Color.White; } } catch (Exception) { } }
private void load_grid(AxFPUSpreadADO.AxfpSpread axGrid) { int imax = Convert.ToInt16(_dt_chart.Rows[0]["COL_COUNT"]); int iColSpan = Convert.ToInt16(_dt_chart.Rows[0]["COL_SPAN"]); axGrid.MaxCols = imax + 2; axGrid.AddCellSpan(3, 4, iColSpan, 1); axGrid.SetText(1, 1, EmptyIfNull(_dt_chart.Rows[0][axGrid.Name.Replace("axGrid_", "") + "_GNAME"].ToString())); for (int i = 0; i < imax; i++) { axGrid.SetText(i + 3, 1, _dt_chart.Rows[i]["TITLE"].ToString()); axGrid.SetText(i + 3, 2, EmptyIfNull2(_dt_chart.Rows[i][axGrid.Name.Replace("axGrid_", "")].ToString())); axGrid.SetText(i + 3, 3, EmptyIfNull(_dt_chart.Rows[i][axGrid.Name.Replace("axGrid_", "") + "_PER"].ToString() + "%")); axGrid.SetText(3, 4, EmptyIfNull(_dt_chart.Rows[0][axGrid.Name.Replace("axGrid_", "") + "_IM"].ToString() + "%")); axGrid.set_ColWidth(i + 3, Convert.ToDouble(_dt_chart.Rows[i]["COL_WIDTH"])); axGrid.Col = i + 3; axGrid.Row = 1; axGrid.FontSize = Convert.ToSingle(_dt_chart.Rows[i]["FONT"]); axGrid.Row = 4; if (i >= iColSpan) { axGrid.BackColor = Color.White; } else { axGrid.BackColor = Color.Navy; } axGrid.FontSize = 35f; axGrid.FontBold = true; } axGrid.SetCellBorder(1, 1, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); axGrid.SetCellBorder(1, 2, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); axGrid.SetCellBorder(1, 2, axGrid.MaxCols, axGrid.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexTop, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); }
private void DisplayGridTop(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { try { _Dic_Location = new Dictionary <string, string>(); if (arg_dt == null || arg_dt.Rows.Count == 0) { return; } Double.TryParse(arg_dt.Rows[0]["WIDTH"].ToString(), out _iWidth); Double.TryParse(arg_dt.Rows[0]["HEIGHT"].ToString(), out _iHeight); // Set Default Grid arg_grid.Visible = false; arg_grid.Reset(); arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone; arg_grid.DisplayColHeaders = false; arg_grid.DisplayRowHeaders = false; arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff; arg_grid.ColHeaderRows = 0; arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone; arg_grid.Font = new System.Drawing.Font("Calibri", 8); arg_grid.set_RowHeight(1, 0.5); arg_grid.set_ColWidth(1, 0.5); arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter; arg_grid.TypeEditMultiLine = true; arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); for (int ic = 2; ic <= 150; ic++) { arg_grid.set_ColWidth(ic, 3.1); } int row_s = 2; int irow = row_s; int icol = 2; MachineHeadTop(icol, irow, 0, arg_dt, arg_grid); irow = row_s + 1; MachineBodyTop(icol, irow, 0, arg_dt, arg_grid); _Dic_Location.Add(irow.ToString() + "-" + icol.ToString(), arg_dt.Rows[0]["SHORT_NAME"].ToString()); for (int i = 1; i < arg_dt.Rows.Count; i++) { if (arg_dt.Rows[i]["LINE_ID"].ToString() == arg_dt.Rows[i - 1]["LINE_ID"].ToString()) { if (arg_dt.Rows[i]["MINI_LINE_ID"].ToString() == arg_dt.Rows[i - 1]["MINI_LINE_ID"].ToString()) { irow++; } else { irow = row_s + 1; icol++; } MachineBodyTop(icol, irow, i, arg_dt, arg_grid); } else { axGridTop.set_ColWidth(icol + 1, 0.4); icol += 2; irow = row_s; MachineHeadTop(icol, irow, i, arg_dt, arg_grid); irow = row_s + 1; MachineBodyTop(icol, irow, i, arg_dt, arg_grid); } string loc = irow.ToString() + "-" + icol.ToString(); //for (int i = 0; i < _Dic_Location.Count; i++) //{ // _Dic_Location. //} _Dic_Location.Add(loc, arg_dt.Rows[i]["SHORT_NAME"].ToString()); } arg_grid.RowsFrozen = irow + 1; } catch { } finally { arg_grid.Visible = true; } }
private void DisplayGridRight(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { int irow = 1, icol = 0; int iTotInput = 0, iTotMold = 0, iInput = 0, iMold = 0; int divRow = 11; arg_grid.Reset(); //arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone; arg_grid.GrayAreaBackColor = Color.White; arg_grid.DisplayColHeaders = false; arg_grid.DisplayRowHeaders = false; arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff; arg_grid.ColHeaderRows = 0; arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone; arg_grid.Font = new System.Drawing.Font("Calibri", 11); //arg_grid.set_RowHeight(1, 0.5); //arg_grid.set_ColWidth(1, 0.5); arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter; arg_grid.TypeEditMultiLine = true; arg_grid.Row = 1; arg_grid.FontBold = true; //for (int ic = 1; ic <= 50; ic++) // arg_grid.set_ColWidth(ic, 12); for (int ir = 1; ir <= divRow; ir++) { arg_grid.set_RowHeight(ir, 15); } // arg_grid.set_RowHeight(1, 22); arg_grid.set_RowHeight(divRow + 1, 18); GridRightHead(1, arg_grid); arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); for (int i = 0; i < arg_dt.Rows.Count; i++) { if (irow == divRow) { icol += 4; irow = 2; GridRightHead(icol + 1, arg_grid); arg_grid.set_ColWidth(icol, 2); arg_grid.SetCellBorder(icol, 1, icol, divRow - 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); //arg_grid.SetCellBorder(irow , icol , 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); // arg_grid.SetCellBorder(irow , icol, 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); } else { irow++; } iInput = Convert.ToInt32(arg_dt.Rows[i]["MOLD_INPUT"]); iMold = Convert.ToInt32(arg_dt.Rows[i]["QTY"]); arg_grid.SetText(icol + 1, irow, arg_dt.Rows[i]["SHORT_NAME"].ToString()); arg_grid.SetText(icol + 2, irow, iMold.ToString("###,###,###")); arg_grid.SetText(icol + 3, irow, iInput.ToString("###,###,###")); iTotInput += Convert.ToInt32(arg_dt.Rows[i]["MOLD_INPUT"]); iTotMold += Convert.ToInt32(arg_dt.Rows[i]["QTY"]); } arg_grid.AddCellSpan(1, divRow + 1, 13, 1); arg_grid.SetText(1, divRow + 1, "Total"); arg_grid.SetText(icol + 3, divRow + 1, iTotInput.ToString("###,###,###")); arg_grid.SetText(icol + 2, divRow + 1, iTotMold.ToString("###,###,###")); arg_grid.Col = -1; arg_grid.Row = divRow + 1; arg_grid.BackColor = Color.FromArgb(232, 232, 127); arg_grid.FontBold = true; arg_grid.FontSize = 14; arg_grid.Col = 1; arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.MaxRows = divRow + 1; arg_grid.MaxCols = 15; }
private void DisplayGridLeft(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { int irow = 1, icol = 0, divRow; int iTotMachine = 0, iTotInput = 0, iTotBal = 0; arg_grid.Reset(); // arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone; arg_grid.GrayAreaBackColor = Color.White; arg_grid.DisplayColHeaders = false; arg_grid.DisplayRowHeaders = false; arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff; arg_grid.ColHeaderRows = 0; arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone; arg_grid.Font = new System.Drawing.Font("Calibri", 11); //arg_grid.set_RowHeight(1, 0.5); //arg_grid.set_ColWidth(1, 0.5); arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter; arg_grid.TypeEditMultiLine = true; arg_grid.Row = 1; arg_grid.FontBold = true; //for (int ic = 1; ic <= 50; ic++) // arg_grid.set_ColWidth(ic, 12); var query = from DataRow dRow in arg_dt.AsEnumerable() // where p.Used = "N" group dRow by dRow["LINE_NAME"] into gp select new { Line = gp.Key, Machine = gp.Count(), Input = gp.Count(dRow => dRow.Field <string>("USE_YN") == "Y") }; divRow = (query.Count() / 2) + 2; for (int ir = 1; ir <= divRow; ir++) { arg_grid.set_RowHeight(ir, 15); } arg_grid.set_RowHeight(divRow + 1, 18); arg_grid.MaxCols = 9; arg_grid.MaxRows = divRow + 1; GridLeftHead(1, arg_grid); arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); arg_grid.SetCellBorder(1, 1, arg_grid.MaxCols, divRow + 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0x4286f4, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); foreach (var element in query) { if (irow == divRow) { icol += 5; irow = 2; GridLeftHead(icol + 1, arg_grid); arg_grid.set_ColWidth(icol, 2); arg_grid.SetCellBorder(icol, 1, icol, divRow - 1, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); //arg_grid.SetCellBorder(irow , icol , 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); // arg_grid.SetCellBorder(irow , icol, 4, divRow, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleSolid); } else { irow++; } arg_grid.SetText(icol + 1, irow, element.Line); arg_grid.SetText(icol + 2, irow, element.Machine); arg_grid.SetText(icol + 3, irow, element.Input); arg_grid.SetText(icol + 4, irow, element.Machine - element.Input); iTotMachine += element.Machine; iTotInput += element.Input; iTotBal += (element.Machine - element.Input); } arg_grid.AddCellSpan(1, divRow + 1, 6, 1); arg_grid.SetText(1, divRow + 1, "Total"); arg_grid.SetText(icol + 2, divRow + 1, iTotMachine.ToString()); arg_grid.SetText(icol + 3, divRow + 1, iTotInput.ToString()); arg_grid.SetText(icol + 4, divRow + 1, iTotBal.ToString()); arg_grid.Col = -1; arg_grid.Row = divRow + 1; arg_grid.BackColor = Color.FromArgb(232, 232, 127); arg_grid.FontBold = true; arg_grid.FontSize = 14; }
private void DisplayGridTop(DataTable arg_dt, AxFPUSpreadADO.AxfpSpread arg_grid) { try { if (arg_dt == null || arg_dt.Rows.Count == 0) { return; } // Set Default Grid arg_grid.Visible = false; arg_grid.Reset(); arg_grid.BorderStyle = FPUSpreadADO.BorderStyleConstants.BorderStyleNone; arg_grid.DisplayColHeaders = false; arg_grid.DisplayRowHeaders = false; arg_grid.ActiveCellHighlightStyle = FPUSpreadADO.ActiveCellHighlightStyleConstants.ActiveCellHighlightStyleOff; arg_grid.ColHeaderRows = 0; arg_grid.ScrollBars = FPUSpreadADO.ScrollBarsConstants.ScrollBarsNone; arg_grid.Font = new System.Drawing.Font("Calibri", 10); arg_grid.set_RowHeight(1, 0.5); arg_grid.set_ColWidth(1, 0.5); arg_grid.TypeHAlign = FPUSpreadADO.TypeHAlignConstants.TypeHAlignCenter; arg_grid.TypeVAlign = FPUSpreadADO.TypeVAlignConstants.TypeVAlignCenter; arg_grid.TypeEditMultiLine = true; arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexLeft, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); arg_grid.SetCellBorder(1, 1, 150, axGridTop.MaxRows, FPUSpreadADO.CellBorderIndexConstants.CellBorderIndexBottom, 0, FPUSpreadADO.CellBorderStyleConstants.CellBorderStyleBlank); for (int ic = 2; ic <= 150; ic++) { arg_grid.set_ColWidth(ic, 4.0); } int row_s = 2; int irow = row_s; int icol = 2; MachineHeadTop(icol, irow, 0, arg_dt, arg_grid); irow = row_s + 1; MachineBodyTop(icol, irow, 0, arg_dt, arg_grid); for (int i = 1; i < arg_dt.Rows.Count; i++) { if (arg_dt.Rows[i]["LINE_ID"].ToString() == arg_dt.Rows[i - 1]["LINE_ID"].ToString()) { if (arg_dt.Rows[i]["MINI_LINE_ID"].ToString() == arg_dt.Rows[i - 1]["MINI_LINE_ID"].ToString()) { irow++; } else { irow = row_s + 1; icol++; } MachineBodyTop(icol, irow, i, arg_dt, arg_grid); } else { axGridTop.set_ColWidth(icol + 1, 0.5); icol += 2; irow = row_s; MachineHeadTop(icol, irow, i, arg_dt, arg_grid); irow = row_s + 1; MachineBodyTop(icol, irow, i, arg_dt, arg_grid); } } } catch { } finally { arg_grid.Visible = true; } }