private void frmSample14_Load(object sender, System.EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); RTLColumnHeaderView viewHeader = new RTLColumnHeaderView(); RTLCheckBoxView viewCheckBox = new RTLCheckBoxView(); grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 0].View = viewHeader; grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 1].View = viewHeader; grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1[0, 2].View = viewHeader; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 2].View = viewCheckBox; } grid1.AutoSizeCells(); }
private void frmSample14_Load(object sender, System.EventArgs e) { grid.BorderStyle = BorderStyle.FixedSingle; grid.ColumnsCount = 4; grid.FixedRows = 1; grid.Rows.Insert(0); SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string)); cbEditor.StandardValues = new string[] { "Value 1", "Value 2", "Value 3" }; cbEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey; grid[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid[0, 3] = new SourceGrid.Cells.ColumnHeader("ComboBox"); for (int r = 1; r < 10; r++) { grid.Rows.Insert(r); grid[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid[r, 3] = new SourceGrid.Cells.Cell("Value 1", cbEditor); grid[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default; } grid.AutoSizeCells(); }
private void AddOneRow(SourceGrid.Grid grid, int r, string c1, string c2, bool isHead) { try { //int rowCount = grid.RowsCount; //grid.Redim(rowCount + 1, 2); grid[r, 0] = new SourceGrid.Cells.Cell(c1, typeof(string)); grid[r, 0].View = isHead ? headerView : cellView; if (isHead) { grid[r, 1] = new SourceGrid.Cells.Cell(c2, typeof(string)); grid[r, 1].View = headerView; } else { bool isCheck = c2 == "on" ? true : false; grid[r, 1] = new SourceGrid.Cells.CheckBox(null, isCheck); grid[r, 1].View = checkView; } //grid.Refresh(); } catch (System.Exception ex) { Program.log.Error(ex, ex); } }
public void Bug_3424() { var grid1 = new Grid(); grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("String"); // here you can se the other column to sort when the current column is equal header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2); var sorter = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1[0, 0] = header1; grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = sorter; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(7 * r), typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox("", true); } grid1[9, 2] = null; grid1[9, 1].ColumnSpan = 2; sorter.Sort(true); }
private void DoFull() { grid1.Redim(20, 4); grid1.FixedRows = 1; grid1[0, 0] = new MyHeader("1"); grid1[0, 0].ColumnSpan = 3; grid1[0, 0].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); grid1[0, 3] = new MyHeader("2"); grid1[0, 3].AddController(new SourceGrid.Cells.Controllers.SortableHeader()); for (int r = 1; r < grid1.RowsCount; r++) { if (r % 2 == 0) { grid1[r, 0] = new SourceGrid.Cells.Cell("nospan" + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell("span" + r.ToString(), typeof(string)); grid1[r, 1].ColumnSpan = 2; } else { grid1[r, 0] = new SourceGrid.Cells.Cell("span" + r.ToString(), typeof(string)); grid1[r, 0].ColumnSpan = 2; grid1[r, 2] = new SourceGrid.Cells.Cell("nospan" + r.ToString(), typeof(string)); } grid1[r, 3] = new SourceGrid.Cells.CheckBox("CheckBox Column/Row Span" + r.ToString(), false); } grid1.AutoSizeCells(); }
private void FillGrid([NotNull] IReadOnlyCollection <TVSettings.FilenameProcessorRE> list) { while (Grid1.Rows.Count > 1) // leave header row { Grid1.Rows.Remove(1); } Grid1.RowsCount = list.Count + 1; int i = 1; foreach (TVSettings.FilenameProcessorRE re in list) { Grid1[i, 0] = new SourceGrid.Cells.CheckBox(null, re.Enabled); Grid1[i, 1] = new SourceGrid.Cells.Cell(re.RegExpression, typeof(string)); Grid1[i, 2] = new SourceGrid.Cells.CheckBox(null, re.UseFullPath); Grid1[i, 3] = new SourceGrid.Cells.Cell(re.Notes, typeof(string)); ChangedCont changed = new ChangedCont(this); for (int c = 0; c < 4; c++) { Grid1[i, c].AddController(changed); } i++; } StartTimer(); }
private void frmSample45_Load(object sender, EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); } grid1.AutoSizeCells(); grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.FocusFirstCellOnEnter; grid1.Selection.FocusStyle = grid1.Selection.FocusStyle | SourceGrid.FocusStyle.RemoveFocusCellOnLeave; chkTabStop.Checked = grid1.TabStop; }
private void UpdateItems() { for (int iRow = 1; iRow < gridContent.RowsCount; ++iRow) { try { SourceGrid.Cells.Editors.NumericUpDown nudEditorNumber = gridContent[iRow, 1].Editor as SourceGrid.Cells.Editors.NumericUpDown; SourceGrid.Cells.Editors.NumericUpDown nudEditorPriority = gridContent[iRow, 2].Editor as SourceGrid.Cells.Editors.NumericUpDown; SourceGrid.Cells.CheckBox checkBoxX = gridContent[iRow, 3] as SourceGrid.Cells.CheckBox; SourceGrid.Cells.CheckBox checkBoxY = gridContent[iRow, 4] as SourceGrid.Cells.CheckBox; SourceGrid.Cells.CheckBox checkBoxZ = gridContent[iRow, 5] as SourceGrid.Cells.CheckBox; Items[iRow - 1].Number = Convert.ToUInt32(nudEditorNumber.GetEditedValue()); Items[iRow - 1].PriorityIndex = Convert.ToInt32(nudEditorPriority.GetEditedValue()); Items[iRow - 1].Orientation = new DCSBBool3() { X = (bool)checkBoxX.Value, Y = (bool)checkBoxY.Value, Z = (bool)checkBoxZ.Value }; } catch (Exception ex) { _log.Error(ex.ToString()); } } }
public void GridBindData(SourceGrid.Grid urlGrid) { urlGrid.Rows.Clear(); urlGrid.Rows.Insert(0); urlGrid[0, 0] = new SourceGrid.Cells.ColumnHeader("URL"); urlGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Sync\nPosition"); urlGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Sync\nScreenshots"); int r = 1; foreach (SyncURL syncURL in _settings.syncURLs) { urlGrid.Rows.Insert(r); urlGrid[r, 0] = new SourceGrid.Cells.Cell(syncURL.URL, typeof(string)); urlGrid[r, 0].Editor = null; urlGrid[r, 1] = new SourceGrid.Cells.CheckBox(null, syncURL.syncPosition); urlGrid[r, 1].Editor = null; urlGrid[r, 2] = new SourceGrid.Cells.CheckBox(null, syncURL.syncScreenshot); urlGrid[r, 2].Editor = null; urlGrid[r, 3] = new SourceGrid.Cells.Button("Edit"); urlGrid[r, 3].Editor = null; urlGrid[r, 3].AddController(gridEditEvent); urlGrid[r, 4] = new SourceGrid.Cells.Button("Delete"); urlGrid[r, 4].Editor = null; urlGrid[r, 4].AddController(gridDeleteEvent); urlGrid[r, 5] = new SourceGrid.Cells.Cell(syncURL.id, typeof(string)); r++; } urlGrid.AutoSizeCells(); }
private void PopulateRow(int r) { grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 3] = new SourceGrid.Cells.Cell("Value 1", cbEditor); grid1[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default; }
private void UpdateGridCheckBoxes() { int iRow = 0; foreach (CasePalletSolution sol in _analysis.Solutions) { ++iRow; SourceGrid.Cells.CheckBox checkBox = gridSolutions[iRow, 6] as SourceGrid.Cells.CheckBox; checkBox.Checked = _analysis.HasSolutionSelected(iRow - 1); } }
public override SourceGrid.Cells.Cell MakeDataCell() { var checkcell = new SourceGrid.Cells.CheckBox(); if (ReadOnly) { checkcell.Editor.EditableMode = EditableMode.None; } checkcell.View = Grid.gridViewModel.dataCellCheckBox; return(checkcell); }
private void UpdateGridCheckBoxes() { int iRow = 0; foreach (TruckSolution solution in _truckAnalysis.Solutions) { ++iRow; SourceGrid.Cells.CheckBox checkBox = gridSolutions[iRow, 7] as SourceGrid.Cells.CheckBox; checkBox.Checked = _truckAnalysis.HasSolutionSelected(iRow - 1); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); DevAge.Drawing.RectangleBorder border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.DarkGreen), new DevAge.Drawing.BorderLine(Color.DarkGreen)); DevAge.Drawing.VisualElements.ColumnHeader flatHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); flatHeader.Border = border; flatHeader.BackColor = Color.ForestGreen; flatHeader.BackgroundColorStyle = DevAge.Drawing.BackgroundColorStyle.Solid; SourceGrid.Cells.Views.ColumnHeader headerView = new SourceGrid.Cells.Views.ColumnHeader(); headerView.Font = new Font(grid1.Font, FontStyle.Bold | FontStyle.Underline); headerView.Background = flatHeader; headerView.ForeColor = Color.White; SourceGrid.Cells.Views.Cell cellView = new SourceGrid.Cells.Views.Cell(); cellView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45); cellView.Border = border; SourceGrid.Cells.Views.CheckBox checkView = new SourceGrid.Cells.Views.CheckBox(); checkView.Background = new DevAge.Drawing.VisualElements.BackgroundLinearGradient(Color.ForestGreen, Color.White, 45); checkView.Border = border; grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 0].View = headerView; grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 1].View = headerView; grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1[0, 2].View = headerView; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 0].View = cellView; grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 1].View = cellView; grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 2].View = checkView; } grid1.AutoSizeCells(); }
private void AddAgent(SNMPAgent agent) { int row = agentGrid.RowsCount; agentGrid.RowsCount++; agentGrid[row, agentGridColName] = new SourceGrid.Cells.Cell(agent.Name); agentGrid[row, agentGridColName].Tag = agent; agentGrid[row, agentGridColActive] = new SourceGrid.Cells.CheckBox("", agent.AgentActive); agentGrid[row, agentGridColAddr] = new SourceGrid.Cells.Cell("IP: " + agent.AgentIP.ToString(), typeof(string)); agentGrid[row, agentGridColPara] = new SourceGrid.Cells.Cell("Version = " + agent.VersionCode.ToString() + ", GetCommunity = " + agent.GetCommunity + ", SetCommunity = " + agent.SetCommunity, typeof(string)); agentGrid[row, agentGridColName].Editor = null; agentGrid[row, agentGridColAddr].Editor = null; agentGrid[row, agentGridColPara].Editor = null; }
private void UpdateGridCheckBoxes() { int iRow = 0; foreach (CylinderPalletSolution sol in _analysis.Solutions) { ++iRow; SourceGrid.Cells.CheckBox checkBox = gridSolutions[iRow, 7] as SourceGrid.Cells.CheckBox; if (null != checkBox) { checkBox.Checked = _analysis.HasSolutionSelected(iRow - 1); } } }
private void AddSerialClientStation(ModbusSerialClientStation stat) { int row = stationGrid.RowsCount; stationGrid.RowsCount++; stationGrid[row, stationGridColName] = new SourceGrid.Cells.Cell(stat.Name); stationGrid[row, stationGridColName].Tag = stat; stationGrid[row, stationGridColActive] = new SourceGrid.Cells.CheckBox("", stat.StationActive); stationGrid[row, stationGridColAddr] = new SourceGrid.Cells.Cell("MODBUS/" + stat.SerialType.ToString() + ", " + stat.ComPort, typeof(string)); stationGrid[row, stationGridColPara] = new SourceGrid.Cells.Cell(stat.BaudRate.ToString() + "," + stat.DataBits.ToString() + "," + stat.Parity.ToString() + "," + stat.StopBits.ToString(), typeof(string)); stationGrid[row, stationGridColName].Editor = null; //stationGrid[row, stationGridColActive].Editor = null; stationGrid[row, stationGridColAddr].Editor = null; stationGrid[row, stationGridColPara].Editor = null; }
private void AddTCPClientStation(ModbusTCPClientStation stat) { int row = stationGrid.RowsCount; stationGrid.RowsCount++; stationGrid[row, stationGridColName] = new SourceGrid.Cells.Cell(stat.Name); stationGrid[row, stationGridColName].Tag = stat; stationGrid[row, stationGridColActive] = new SourceGrid.Cells.CheckBox("", stat.StationActive); stationGrid[row, stationGridColAddr] = new SourceGrid.Cells.Cell("MODBUS/TCP, " + stat.IPAddress, typeof(string)); stationGrid[row, stationGridColPara] = new SourceGrid.Cells.Cell("TCPport = " + stat.TCPPort, typeof(int)); stationGrid[row, stationGridColName].Editor = null; //stationGrid[row, stationGridColActive].Editor = null; stationGrid[row, stationGridColAddr].Editor = null; stationGrid[row, stationGridColPara].Editor = null; }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); grid1.Redim(30, 2); grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("Checked"); grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("CheckStatus"); SourceGrid.Cells.Editors.ComboBox combo = new SourceGrid.Cells.Editors.ComboBox(typeof(DevAge.Drawing.CheckBoxState)); DependencyColumn boolToStatus = new DependencyColumn(1); boolToStatus.ConvertFunction = delegate(object valBool) { if (valBool == null) return DevAge.Drawing.CheckBoxState.Undefined; else if ((bool)valBool == true) return DevAge.Drawing.CheckBoxState.Checked; else return DevAge.Drawing.CheckBoxState.Unchecked; }; DependencyColumn statusToBool = new DependencyColumn(0); statusToBool.ConvertFunction = delegate(object valStatus) { DevAge.Drawing.CheckBoxState status = (DevAge.Drawing.CheckBoxState)valStatus; if (status == DevAge.Drawing.CheckBoxState.Undefined) return null; else if (status == DevAge.Drawing.CheckBoxState.Checked) return true; else return false; }; for (int r = 1; r < grid1.RowsCount; r++) { grid1[r, 0] = new SourceGrid.Cells.CheckBox(null, null); grid1[r, 0].Editor.AllowNull = true; grid1[r, 0].AddController(boolToStatus); grid1[r, 1] = new SourceGrid.Cells.Cell(DevAge.Drawing.CheckBoxState.Undefined, combo); grid1[r, 1].AddController(statusToBool); } grid1.AutoSizeCells(); }
private void AddNewRow() { int r = Grid1.RowsCount; Grid1.RowsCount = r + 1; Grid1[r, 0] = new SourceGrid.Cells.CheckBox(null, true); Grid1[r, 1] = new SourceGrid.Cells.Cell("", typeof(string)); Grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, false); Grid1[r, 3] = new SourceGrid.Cells.Cell("", typeof(string)); ChangedCont changed = new ChangedCont(this); for (int c = 0; c < 4; c++) { Grid1[r, c].AddController(changed); } }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.Views.ColumnHeader boldHeader = new SourceGrid.Cells.Views.ColumnHeader(); boldHeader.Font = new Font(grid1.Font, FontStyle.Bold | FontStyle.Underline); SourceGrid.Cells.Views.Cell yellowView = new SourceGrid.Cells.Views.Cell(); yellowView.BackColor = Color.Yellow; SourceGrid.Cells.Views.CheckBox yellowViewCheck = new SourceGrid.Cells.Views.CheckBox(); yellowViewCheck.BackColor = Color.Yellow; grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 0].View = boldHeader; grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 1].View = boldHeader; grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1[0, 2].View = boldHeader; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 0].View = yellowView; grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 1].View = yellowView; grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 2].View = yellowViewCheck; } grid1.AutoSizeCells(); }
private void frmSample50_Load(object sender, EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); for (int r = 1; r < 100; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); } grid1.AutoSizeCells(); }
private void AddVariable(string variableName, string type, bool readOnly) { int row = grid.RowsCount; grid.RowsCount++; grid[row, 0] = new SourceGrid.Cells.Cell(variableName, typeof(string)); SourceGrid.Cells.Editors.ComboBox combo = new SourceGrid.Cells.Editors.ComboBox(typeof(string), channelNames, true); combo.Control.Sorted = true; combo.Control.DropDownStyle = ComboBoxStyle.DropDownList; combo.Control.SelectionChangeCommitted += new EventHandler(OnChannelTypeChanged); grid[row, 1] = new SourceGrid.Cells.Cell(variableTypeNames[type], combo); SourceGrid.Cells.CheckBox check = new SourceGrid.Cells.CheckBox(); check.Checked = readOnly; grid[row, 2] = check; grid.Selection.ResetSelection(true); grid.Selection.SelectRow(row, true); }
private void brAddRow_Click(object sender, System.EventArgs e) { int row = grid1.RowsCount; grid1.Rows.Insert(row); grid1[row, 0] = new SourceGrid.Cells.RowHeader(null); grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id); grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name); grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue, mEditor_Address); grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue, mEditor_City); grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay); grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country); grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price); grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false); SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com"); link.AddController(mController_Link); grid1[row, 9] = link; grid1.Selection.FocusRow(row); }
private void frmSample50_Load(object sender, EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1.Rows.SuspendLayout(); for (int r = 1; r < 100; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); } grid1.Rows.ResumeLayout(); grid1.AutoSizeCells(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; //grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0, 0] = new EditableColumnHeader("String"); grid1[0, 1] = new EditableColumnHeader("DateTime"); grid1[0, 2] = new EditableColumnHeader("CheckBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); } grid1.AutoSizeCells(); }
private void frmSample47_Load(object sender, EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.ColumnHeader header1 = new SourceGrid.Cells.ColumnHeader("String"); // here you can se the other column to sort when the current column is equal header1.SortComparer = new SourceGrid.MultiColumnsComparer(1, 2); grid1[0, 0] = header1; grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today.AddDays(7 * r), typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox("", true); } grid1.AutoSizeCells(); }
private void AddOneRowFuture(SourceGrid.Grid grid, int r, string product, bool isCheck, string tick, int point, string symbol) { try { grid[r, 0] = new SourceGrid.Cells.Cell(product, typeof(string)); grid[r, 0].View = cellView; grid[r, 1] = new SourceGrid.Cells.CheckBox(null, isCheck); grid[r, 1].View = checkView; grid[r, 2] = new SourceGrid.Cells.Cell(tick, typeof(string)); grid[r, 2].View = cellView; grid[r, 3] = new SourceGrid.Cells.Cell(point, typeof(int)); grid[r, 3].View = cellView; if (!string.IsNullOrEmpty(symbol)) { grid[r, 4] = new SourceGrid.Cells.Cell(symbol, typeof(string)); grid[r, 4].View = cellView; } } catch (System.Exception ex) { Program.log.Error(ex, ex); } }
internal void PopulatePressures() { SourceGrid.Cells.Editors.TextBox pressureEditor = new SourceGrid.Cells.Editors.TextBox(typeof(Double)); pressureEditor.EditableMode = SourceGrid.EditableMode.None; int gridRow = 1; PressureChangedEvent valueChangedController = new PressureChangedEvent(this); foreach (String keyLine in bfbObject.PressureLineList.Keys) { int index = bfbObject.PressureLineList[keyLine][0]; Double pressure = bfbObject.PressureDictionary[index]; gridPressure.Rows.Insert(gridRow); gridPressure[gridRow, 0] = new SourceGrid.Cells.CheckBox("", false); gridPressure[gridRow, 1] = new SourceGrid.Cells.Cell(pressure, typeof(double)); gridPressure[gridRow, 1].AddController(valueChangedController); gridPressure[gridRow, 2] = new SourceGrid.Cells.Cell(0, typeof(double)); gridPressure[gridRow, 3] = new SourceGrid.Cells.Cell(index, pressureEditor); gridRow++; } }
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(); }
protected override void OnLoad(EventArgs e) { base.OnLoad (e); grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; //grid1.FixedRows = 1; grid1.Rows.Insert(0); grid1[0,0] = new EditableColumnHeader("String"); grid1[0,1] = new EditableColumnHeader("DateTime"); grid1[0,2] = new EditableColumnHeader("CheckBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r,0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r,1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r,2] = new SourceGrid.Cells.CheckBox(null, true); } 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 = 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(); }
private void GUI_Check_List_Load(object sender, EventArgs e) { //useless corner tile checksGrid.Columns.Insert(0); checksGrid.Rows.Insert(0); //columns checksGrid.Columns.Insert(0); checksGrid.Columns.Insert(0); checksGrid.Columns.Insert(0); //add rows foreach (Check c in _getChecks()) { checksGrid.Rows.Insert(0); SourceGrid.Cells.Views.Cell rowView = new SourceGrid.Cells.Views.Cell(); SourceGrid.Cells.Views.CheckBox checkView = new SourceGrid.Cells.Views.CheckBox(); System.Drawing.Color cellColour; if (c.IsTriggered()) { cellColour = System.Drawing.Color.Red; } else if (c.HasError()) { cellColour = System.Drawing.Color.Yellow; } else if (c.IsPaused()) { cellColour = System.Drawing.Color.LightBlue; } else { cellColour = System.Drawing.Color.White; } rowView.BackColor = cellColour; checkView.BackColor = cellColour; checksGrid[1, 0] = new SourceGrid.Cells.RowHeader(c.GetIndex()); checksGrid[1, 1] = new SourceGrid.Cells.Cell(c.GetCheckType()); checksGrid[1, 1].View = rowView; checksGrid[1, 2] = new SourceGrid.Cells.Cell(c.GetLocation()); checksGrid[1, 2].View = rowView; SourceGrid.Cells.CheckBox pauseBox = new SourceGrid.Cells.CheckBox(); pauseBox.Checked = c.IsPaused(); checksGrid[1, 3] = pauseBox; checksGrid[1, 3].View = checkView; } //add column headers checksGrid[0, 1] = new SourceGrid.Cells.ColumnHeader("Name"); checksGrid[0, 2] = new SourceGrid.Cells.ColumnHeader("Location"); checksGrid[0, 3] = new SourceGrid.Cells.ColumnHeader("Paused"); checksGrid.AutoSizeCells(); }
private void FillContentGrid() { try { // remove existing rows gridContent.Rows.Clear(); // viewColumnHeader SourceGrid.Cells.Views.ColumnHeader 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; // viewNormal CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.LightBlue, Color.White); // *** // set first row gridContent.BorderStyle = BorderStyle.FixedSingle; gridContent.ColumnsCount = 5; gridContent.FixedRows = 1; // header int iCol = 0; gridContent.Rows.Insert(0); gridContent[0, iCol] = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NAME) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridContent[0, ++iCol] = new SourceGrid.Cells.ColumnHeader(Properties.Resources.ID_NUMBER) { AutomaticSortEnabled = false, View = viewColumnHeader }; gridContent[0, ++iCol] = new SourceGrid.Cells.ColumnHeader("X") { AutomaticSortEnabled = false, View = viewColumnHeader }; gridContent[0, ++iCol] = new SourceGrid.Cells.ColumnHeader("Y") { AutomaticSortEnabled = false, View = viewColumnHeader }; gridContent[0, ++iCol] = new SourceGrid.Cells.ColumnHeader("Z") { AutomaticSortEnabled = false, View = viewColumnHeader }; // content int iIndex = 0; foreach (ContentItem ci in ContentItems) { // insert row gridContent.Rows.Insert(++iIndex); iCol = 0; // name gridContent[iIndex, iCol] = new SourceGrid.Cells.Cell(ci.Pack.Name) { View = viewNormal, Tag = ci.Pack }; // number gridContent[iIndex, ++iCol] = new SourceGrid.Cells.Cell((int)ci.Number) { View = viewNormal }; SourceGrid.Cells.Editors.NumericUpDown l_NumericUpDownEditor = new SourceGrid.Cells.Editors.NumericUpDown(typeof(int), 10000, 0, 1); l_NumericUpDownEditor.SetEditValue((int)ci.Number); gridContent[iIndex, iCol].Editor = l_NumericUpDownEditor; gridContent[iIndex, iCol].AddController(_numUpDownEvent); // orientation X gridContent[iIndex, ++iCol] = new SourceGrid.Cells.CheckBox(null, ci.AllowOrientX); gridContent[iIndex, iCol].AddController(_checkBoxEvent); // orientation Y gridContent[iIndex, ++iCol] = new SourceGrid.Cells.CheckBox(null, ci.AllowOrientY); gridContent[iIndex, iCol].AddController(_checkBoxEvent); // orientation Z gridContent[iIndex, ++iCol] = new SourceGrid.Cells.CheckBox(null, ci.AllowOrientZ); gridContent[iIndex, iCol].AddController(_checkBoxEvent); } gridContent.AutoSizeCells(); gridContent.Columns.StretchToFit(); gridContent.AutoStretchColumnsToFitWidth = true; gridContent.Invalidate(); } catch (Exception ex) { _log.Error(ex.ToString()); } }
private void brAddRow_Click(object sender, System.EventArgs e) { int row = grid1.RowsCount; grid1.Rows.Insert(row); grid1[row, 0] = new SourceGrid.Cells.RowHeader(null); grid1[row, 1] = new SourceGrid.Cells.Cell(grid1.RowsCount, mEditor_Id); grid1[row, 2] = new SourceGrid.Cells.Cell(mEditor_Name.DefaultValue, mEditor_Name); grid1[row, 3] = new SourceGrid.Cells.Cell(mEditor_Address.DefaultValue,mEditor_Address); grid1[row, 4] = new SourceGrid.Cells.Cell(mEditor_City.DefaultValue,mEditor_City); grid1[row, 5] = new SourceGrid.Cells.Cell(mEditor_BirthDay.DefaultValue, mEditor_BirthDay); grid1[row, 6] = new SourceGrid.Cells.Cell(mEditor_Country.DefaultValue, mEditor_Country); grid1[row, 7] = new SourceGrid.Cells.Cell(mEditor_Price.DefaultValue, mEditor_Price); grid1[row, 8] = new SourceGrid.Cells.CheckBox(null, false); SourceGrid.Cells.Link link = new SourceGrid.Cells.Link("http://www.codeproject.com"); link.AddController(mController_Link); grid1[row, 9] = link; grid1.Selection.FocusRow(row); }
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 = 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 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(); }
protected override void OnLoad(EventArgs e) { base.OnLoad(e); grid.Redim(62, 3); SourceGrid.Cells.Views.Cell titleModel = new SourceGrid.Cells.Views.Cell(); titleModel.BackColor = Color.SteelBlue; titleModel.ForeColor = Color.White; titleModel.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; SourceGrid.Cells.Views.Cell captionModel = new SourceGrid.Cells.Views.Cell(); captionModel.BackColor = grid.BackColor; int currentRow = 0; #region Base Types grid[currentRow, 0] = new SourceGrid.Cells.Cell("Base Types"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //string grid[currentRow, 0] = new SourceGrid.Cells.Cell("String"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("String Value", typeof(string)); currentRow++; //double grid[currentRow, 0] = new SourceGrid.Cells.Cell("Double"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(1.5, typeof(double)); currentRow++; //int grid[currentRow, 0] = new SourceGrid.Cells.Cell("Int"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(5, typeof(int)); currentRow++; //DateTime grid[currentRow, 0] = new SourceGrid.Cells.Cell("DateTime"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(DateTime.Now, typeof(DateTime)); currentRow++; //Boolean grid[currentRow, 0] = new SourceGrid.Cells.Cell("Boolean"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(true, typeof(Boolean)); currentRow++; #endregion #region Complex Types grid[currentRow, 0] = new SourceGrid.Cells.Cell("Complex Types"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //Font grid[currentRow, 0] = new SourceGrid.Cells.Cell("Font"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(this.Font, typeof(Font)); currentRow++; //Cursor grid[currentRow, 0] = new SourceGrid.Cells.Cell("Cursor"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(Cursors.Arrow, typeof(Cursor)); currentRow++; //Point grid[currentRow, 0] = new SourceGrid.Cells.Cell("Point"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(new Point(2, 3), typeof(Point)); currentRow++; //Rectangle grid[currentRow, 0] = new SourceGrid.Cells.Cell("Rectangle"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(new Rectangle(100, 100, 200, 200), typeof(Rectangle)); currentRow++; //Image grid[currentRow, 0] = new SourceGrid.Cells.Cell("Image"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Image(Properties.Resources.CalcioSmall); currentRow++; //Enum AnchorStyle grid[currentRow, 0] = new SourceGrid.Cells.Cell("AnchorStyle"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(AnchorStyles.Bottom, typeof(AnchorStyles)); currentRow++; //Enum grid[currentRow, 0] = new SourceGrid.Cells.Cell("Enum"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(System.Windows.Forms.BorderStyle.Fixed3D, typeof(System.Windows.Forms.BorderStyle)); currentRow++; //String[] grid[currentRow, 0] = new SourceGrid.Cells.Cell("String Array"); grid[currentRow, 0].View = captionModel; string[] strArray = new string[] { "Value 1", "Value 2" }; grid[currentRow, 1] = new SourceGrid.Cells.Cell(strArray, typeof(string[])); currentRow++; //Double[] grid[currentRow, 0] = new SourceGrid.Cells.Cell("Double Array"); grid[currentRow, 0].View = captionModel; double[] dblArray = new double[] { 1, 0.5, 0.1 }; grid[currentRow, 1] = new SourceGrid.Cells.Cell(dblArray, typeof(double[])); currentRow++; #endregion #region Special Editors grid[currentRow, 0] = new SourceGrid.Cells.Cell("Special Editors"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //Time grid[currentRow, 0] = new SourceGrid.Cells.Cell("Time"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(DateTime.Now); grid[currentRow, 1].Editor = new SourceGrid.Cells.Editors.TimePicker(); currentRow++; //Double Chars Validation grid[currentRow, 0] = new SourceGrid.Cells.Cell("Double Chars Validation"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.TextBoxNumeric numericEditor = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(double)); numericEditor.KeyPress += delegate(object sender, KeyPressEventArgs keyArgs) { bool isValid = char.IsNumber(keyArgs.KeyChar) || keyArgs.KeyChar == System.Globalization.CultureInfo.CurrentCulture.NumberFormat.NumberDecimalSeparator[0]; keyArgs.Handled = !isValid; }; grid[currentRow, 1] = new SourceGrid.Cells.Cell(0.5); grid[currentRow, 1].Editor = numericEditor; currentRow++; //String Chars (ABC) grid[currentRow, 0] = new SourceGrid.Cells.Cell("Chars Validation(only ABC)"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.TextBox stringEditor = new SourceGrid.Cells.Editors.TextBox(typeof(string)); stringEditor.KeyPress += delegate(object sender, KeyPressEventArgs keyArgs) { keyArgs.KeyChar = char.ToUpper(keyArgs.KeyChar); bool isValid = keyArgs.KeyChar == 'A' || keyArgs.KeyChar == 'B' || keyArgs.KeyChar == 'C'; keyArgs.Handled = !isValid; }; grid[currentRow, 1] = new SourceGrid.Cells.Cell("AABB"); grid[currentRow, 1].Editor = stringEditor; currentRow++; //String Validating grid[currentRow, 0] = new SourceGrid.Cells.Cell("String validating(min 6 chars)"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.TextBox stringEditorValidating = new SourceGrid.Cells.Editors.TextBox(typeof(string)); stringEditorValidating.Control.Validating += delegate(object sender, CancelEventArgs cancelEvent) { string val = ((TextBox)sender).Text; if (val == null || val.Length < 6) cancelEvent.Cancel = true; }; grid[currentRow, 1] = new SourceGrid.Cells.Cell("test string"); grid[currentRow, 1].Editor = stringEditorValidating; currentRow++; //Int 0-100 or null grid[currentRow, 0] = new SourceGrid.Cells.Cell("Int 0-100 or null"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.TextBoxNumeric numericEditor0_100 = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(int)); numericEditor0_100.MinimumValue = 0; numericEditor0_100.MaximumValue = 100; numericEditor0_100.AllowNull = true; grid[currentRow, 1] = new SourceGrid.Cells.Cell(7); grid[currentRow, 1].Editor = numericEditor0_100; currentRow++; //Double Custom Conversion grid[currentRow, 0] = new SourceGrid.Cells.Cell("Dbl custom conversion"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.TextBox dblCustomConversion = new SourceGrid.Cells.Editors.TextBox(typeof(double)); dblCustomConversion.ConvertingObjectToValue += delegate(object sender, DevAge.ComponentModel.ConvertingObjectEventArgs conv) { if (conv.Value is string) { //Here you can add any custom code double val; if (double.TryParse((string)conv.Value, out val)) { conv.Value = val; conv.ConvertingStatus = DevAge.ComponentModel.ConvertingStatus.Completed; } } }; grid[currentRow, 1] = new SourceGrid.Cells.Cell(73.839); grid[currentRow, 1].Editor = dblCustomConversion; currentRow++; //Enum Custom Display grid[currentRow, 0] = new SourceGrid.Cells.Cell("Enum Custom Display"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox keysCombo = new SourceGrid.Cells.Editors.ComboBox(typeof(Keys)); keysCombo.Control.FormattingEnabled = true; keysCombo.ConvertingValueToDisplayString += delegate(object sender, DevAge.ComponentModel.ConvertingObjectEventArgs convArgs) { if (convArgs.Value is Keys) convArgs.Value = (int)((Keys)convArgs.Value) + " - " + convArgs.Value.ToString(); }; grid[currentRow, 1] = new SourceGrid.Cells.Cell(Keys.Enter); grid[currentRow, 1].Editor = keysCombo; currentRow++; string[] arraySample = new string[] { "Value 1", "Value 2", "Value 3" }; //ComboBox 1 grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox String"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox comboStandard = new SourceGrid.Cells.Editors.ComboBox(typeof(string), arraySample, false); comboStandard.Control.MaxLength = 10; grid[currentRow, 1] = new SourceGrid.Cells.Cell(arraySample[0], comboStandard); currentRow++; //ComboBox exclusive grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox String Exclusive"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox comboExclusive = new SourceGrid.Cells.Editors.ComboBox(typeof(string), arraySample, true); grid[currentRow, 1] = new SourceGrid.Cells.Cell(arraySample[0], comboExclusive); currentRow++; //ComboBox AutoComplete grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox AutoComplete"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox comboAutoComplete = new SourceGrid.Cells.Editors.ComboBox(typeof(string), new string[] { "AAA", "ABC", "AZA", "BAA", "ZAA" }, true); comboAutoComplete.Control.AutoCompleteSource = AutoCompleteSource.ListItems; comboAutoComplete.Control.AutoCompleteMode = AutoCompleteMode.Append; grid[currentRow, 1] = new SourceGrid.Cells.Cell("AAA", comboAutoComplete); currentRow++; //ComboBox DropDownList grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox DropDownList"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox comboNoText = new SourceGrid.Cells.Editors.ComboBox(typeof(string), arraySample, true); grid[currentRow, 1] = new SourceGrid.Cells.Cell(arraySample[0]); grid[currentRow, 1].Editor = comboNoText; comboNoText.Control.DropDownStyle = ComboBoxStyle.DropDownList; currentRow++; //ComboBox DateTime Editable grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox DateTime"); grid[currentRow, 0].View = captionModel; DateTime[] arrayDt = new DateTime[] { new DateTime(1981, 10, 6), new DateTime(1991, 10, 6), new DateTime(2001, 10, 6) }; SourceGrid.Cells.Editors.ComboBox comboDateTime = new SourceGrid.Cells.Editors.ComboBox(typeof(DateTime), arrayDt, false); grid[currentRow, 1] = new SourceGrid.Cells.Cell(arrayDt[0], comboDateTime); currentRow++; //ComboBox Custom Display (create a datamodel that has a custom display string) grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox Custom Display"); grid[currentRow, 0].View = captionModel; int[] arrInt = new int[] { 0, 1, 2, 3, 4 }; string[] arrStr = new string[] { "0 - Zero", "1 - One", "2 - Two", "3 - Three", "4- Four" }; SourceGrid.Cells.Editors.ComboBox editorComboCustomDisplay = new SourceGrid.Cells.Editors.ComboBox(typeof(int), arrInt, true); editorComboCustomDisplay.Control.FormattingEnabled = true; DevAge.ComponentModel.Validator.ValueMapping comboMapping = new DevAge.ComponentModel.Validator.ValueMapping(); comboMapping.DisplayStringList = arrStr; comboMapping.ValueList = arrInt; comboMapping.SpecialList = arrStr; comboMapping.SpecialType = typeof(string); comboMapping.BindValidator(editorComboCustomDisplay); grid[currentRow, 1] = new SourceGrid.Cells.Cell(0); grid[currentRow, 1].Editor = editorComboCustomDisplay; SourceGrid.Cells.Cell l_CellComboRealValue = new SourceGrid.Cells.Cell(grid[currentRow, 1].Value); l_CellComboRealValue.View = captionModel; SourceGrid.Cells.Controllers.BindProperty l_ComboBindProperty = new SourceGrid.Cells.Controllers.BindProperty(typeof(SourceGrid.Cells.Cell).GetProperty("Value"), l_CellComboRealValue); grid[currentRow, 1].AddController(l_ComboBindProperty); grid[currentRow, 2] = l_CellComboRealValue; currentRow++; //ComboBox with inline View grid[currentRow, 0] = new SourceGrid.Cells.Cell("ComboBox Inline View"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.ComboBox cbInline = new SourceGrid.Cells.Editors.ComboBox(typeof(string), arraySample, false); cbInline.EditableMode = SourceGrid.EditableMode.Default | SourceGrid.EditableMode.Focus; grid[currentRow, 1] = new SourceGrid.Cells.Cell(arraySample[0], cbInline); grid[currentRow, 1].View = SourceGrid.Cells.Views.ComboBox.Default; currentRow++; //Numeric Up Down Editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("NumericUpDown"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(0); SourceGrid.Cells.Editors.NumericUpDown l_NumericUpDownEditor = new SourceGrid.Cells.Editors.NumericUpDown(typeof(int), 50, -50, 1); grid[currentRow, 1].Editor = l_NumericUpDownEditor; currentRow++; //Multiline Textbox grid[currentRow, 0] = new SourceGrid.Cells.Cell("Multiline Textbox"); grid[currentRow, 0].View = captionModel; grid[currentRow, 0].ColumnSpan = 1; grid[currentRow, 0].RowSpan = 2; grid[currentRow, 1] = new SourceGrid.Cells.Cell("Hello\r\nWorld"); SourceGrid.Cells.Editors.TextBox l_MultilineEditor = new SourceGrid.Cells.Editors.TextBox(typeof(string)); l_MultilineEditor.Control.Multiline = true; grid[currentRow, 1].Editor = l_MultilineEditor; grid[currentRow, 1].RowSpan = 2; currentRow++; currentRow++; //Boolean (CheckBox) grid[currentRow, 0] = new SourceGrid.Cells.Cell("Boolean (CheckBox)"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.CheckBox(null, true); grid[currentRow, 1].FindController<SourceGrid.Cells.Controllers.CheckBox>().CheckedChanged += InvertDisabledCheckBox(currentRow); SourceGrid.Cells.CheckBox l_DisabledCheckBox = new SourceGrid.Cells.CheckBox("Disabled Checkbox", true); l_DisabledCheckBox.Editor.EnableEdit = false; grid[currentRow, 2] = l_DisabledCheckBox; currentRow++; //DateTime with DateTimePicker Editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("DateTimePicker"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.DateTimePicker editorDtPicker = new SourceGrid.Cells.Editors.DateTimePicker(); grid[currentRow, 1] = new SourceGrid.Cells.Cell(DateTime.Today); grid[currentRow, 1].Editor = editorDtPicker; currentRow++; //DateTime with DateTimePicker nullable Editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("DateTimePicker nullable"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Editors.DateTimePicker editorDtPickerNull = new SourceGrid.Cells.Editors.DateTimePicker(); editorDtPickerNull.AllowNull = true; grid[currentRow, 1] = new SourceGrid.Cells.Cell(null); grid[currentRow, 1].Editor = editorDtPickerNull; currentRow++; //File editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("File editor"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("c:\\windows\\System32\\user32.dll", new EditorFileDialog()); currentRow++; // Richtext box grid[currentRow, 0] = new SourceGrid.Cells.Cell("RichTextBox editor"); grid[currentRow, 0].View = captionModel; string rtf = "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0" + "Microsoft Sans Serif;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs17 Only a \\b " + "Test\\b0.\\par\r\n}\r\n"; var richTextBox = new SourceGrid.Cells.RichTextBox(new RichText(rtf)); grid[currentRow, 1] = richTextBox; currentRow++; #endregion #region Special Cells grid[currentRow, 0] = new SourceGrid.Cells.Cell("Special Cells"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //Cell Button grid[currentRow, 0] = new SourceGrid.Cells.Cell("Cell Button"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Button("CellButton"); grid[currentRow, 1].Image = Properties.Resources.FACE02.ToBitmap(); SourceGrid.Cells.Controllers.Button buttonClickEvent = new SourceGrid.Cells.Controllers.Button(); buttonClickEvent.Executed += new EventHandler(CellButton_Click); grid[currentRow, 1].Controller.AddController(buttonClickEvent); currentRow++; //Cell Link grid[currentRow, 0] = new SourceGrid.Cells.Cell("Cell Link"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Link("CellLink"); SourceGrid.Cells.Controllers.Button linkClickEvent = new SourceGrid.Cells.Controllers.Button(); linkClickEvent.Executed += new EventHandler(CellLink_Click); grid[currentRow, 1].Controller.AddController(linkClickEvent); currentRow++; //Custom draw cell grid[currentRow, 0] = new SourceGrid.Cells.Cell("Custom draw cell"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("CustomView"); grid[currentRow, 1].View = new RoundView(); currentRow++; //Control Cell grid[currentRow, 0] = new SourceGrid.Cells.Cell("Control Cell"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("control cell"); ProgressBar progressBar = new ProgressBar(); progressBar.Value = 50; grid.LinkedControls.Add(new SourceGrid.LinkedControlValue(progressBar, new SourceGrid.Position(currentRow, 1))); currentRow++; //Custom Border Cell grid[currentRow, 0] = new SourceGrid.Cells.Cell("Custom Border"); grid[currentRow, 0].View = captionModel; SourceGrid.Cells.Views.Cell viewCustomBorder = new SourceGrid.Cells.Views.Cell(); viewCustomBorder.Border = new DevAge.Drawing.RectangleBorder(new DevAge.Drawing.BorderLine(Color.Red, 1), new DevAge.Drawing.BorderLine(Color.Blue, 1), new DevAge.Drawing.BorderLine(Color.Violet, 1), new DevAge.Drawing.BorderLine(Color.Green, 1)); grid[currentRow, 1] = new SourceGrid.Cells.Cell("Custom Border"); grid[currentRow, 1].View = viewCustomBorder; currentRow++; #endregion #region Custom Formatting grid[currentRow, 0] = new SourceGrid.Cells.Cell("Custom Formatting"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //Format grid[currentRow, 0] = new SourceGrid.Cells.Cell("Default Format"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(88.5246); SourceGrid.Cells.Editors.TextBox editorCustom = new SourceGrid.Cells.Editors.TextBox(typeof(double)); editorCustom.TypeConverter = new DevAge.ComponentModel.Converter.CurrencyTypeConverter(typeof(double)); DevAge.ComponentModel.Converter.NumberTypeConverter numberFormatCustom = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double)); editorCustom.TypeConverter = numberFormatCustom; grid[currentRow, 1].Editor = editorCustom; currentRow++; //Percent Editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("Percent Format"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(88.5246); SourceGrid.Cells.Editors.TextBox l_PercentEditor = new SourceGrid.Cells.Editors.TextBox(typeof(double)); l_PercentEditor.TypeConverter = new DevAge.ComponentModel.Converter.PercentTypeConverter(typeof(double)); grid[currentRow, 1].Editor = l_PercentEditor; currentRow++; //Currency Editor grid[currentRow, 0] = new SourceGrid.Cells.Cell("Currency Format"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(88.5246M); SourceGrid.Cells.Editors.TextBox l_CurrencyEditor = new SourceGrid.Cells.Editors.TextBox(typeof(decimal)); l_CurrencyEditor.TypeConverter = new DevAge.ComponentModel.Converter.CurrencyTypeConverter(typeof(decimal)); grid[currentRow, 1].Editor = l_CurrencyEditor; currentRow++; //Format (#.00) grid[currentRow, 0] = new SourceGrid.Cells.Cell("Format #.00"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(88.5246); editorCustom = new SourceGrid.Cells.Editors.TextBox(typeof(double)); numberFormatCustom = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double)); numberFormatCustom.Format = "#.00"; editorCustom.TypeConverter = numberFormatCustom; grid[currentRow, 1].Editor = editorCustom; currentRow++; //Format ("0000.0000") grid[currentRow, 0] = new SourceGrid.Cells.Cell("Format 0000.0000"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(88.5246); editorCustom = new SourceGrid.Cells.Editors.TextBox(typeof(double)); numberFormatCustom = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double)); numberFormatCustom.Format = "0000.0000"; editorCustom.TypeConverter = numberFormatCustom; grid[currentRow, 1].Editor = editorCustom; currentRow++; //Format ("Scientific (exponential)") grid[currentRow, 0] = new SourceGrid.Cells.Cell("Format Scientific"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(0.0006); SourceGrid.Cells.Editors.TextBoxNumeric editorExponential = new SourceGrid.Cells.Editors.TextBoxNumeric(typeof(double)); DevAge.ComponentModel.Converter.NumberTypeConverter exponentialConverter = new DevAge.ComponentModel.Converter.NumberTypeConverter(typeof(double), "e"); exponentialConverter.NumberStyles = System.Globalization.NumberStyles.Float | System.Globalization.NumberStyles.AllowExponent; editorExponential.TypeConverter = exponentialConverter; grid[currentRow, 1].Editor = editorExponential; currentRow++; //DateTime 2 (using custom formatting) string dtFormat2 = "yyyy MM dd"; grid[currentRow, 0] = new SourceGrid.Cells.Cell("Date(" + dtFormat2 + ")"); grid[currentRow, 0].View = captionModel; string[] dtParseFormats = new string[] { dtFormat2 }; System.Globalization.DateTimeStyles dtStyles = System.Globalization.DateTimeStyles.AllowInnerWhite | System.Globalization.DateTimeStyles.AllowLeadingWhite | System.Globalization.DateTimeStyles.AllowTrailingWhite | System.Globalization.DateTimeStyles.AllowWhiteSpaces; TypeConverter dtConverter = new DevAge.ComponentModel.Converter.DateTimeTypeConverter(dtFormat2, dtParseFormats, dtStyles); SourceGrid.Cells.Editors.TextBoxUITypeEditor editorDt2 = new SourceGrid.Cells.Editors.TextBoxUITypeEditor(typeof(DateTime)); editorDt2.TypeConverter = dtConverter; grid[currentRow, 1] = new SourceGrid.Cells.Cell(DateTime.Today); grid[currentRow, 1].Editor = editorDt2; currentRow++; //Text Ellipses grid[currentRow, 0] = new SourceGrid.Cells.Cell("Text Ellipses"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("This text is very very long and shows how to trim and add ellipses", typeof(string)); SourceGrid.Cells.Views.Cell ellipsesView = new SourceGrid.Cells.Views.Cell(); ellipsesView.TrimmingMode = SourceGrid.TrimmingMode.Word; grid[currentRow, 1].View = ellipsesView; currentRow++; #endregion #region Image And Text Properties grid[currentRow, 0] = new SourceGrid.Cells.Cell("Image And Text Properties"); grid[currentRow, 0].View = titleModel; grid[currentRow, 0].ColumnSpan = 3; currentRow++; //Cell Image SourceGrid.Cells.Cell cellImage1 = new SourceGrid.Cells.Cell("Single Image"); SourceGrid.Cells.Views.Cell viewImage = new SourceGrid.Cells.Views.Cell(captionModel); cellImage1.View = viewImage; grid[currentRow, 2] = cellImage1; cellImage1.RowSpan = 4; cellImage1.Image = Properties.Resources.FACE02.ToBitmap(); grid[currentRow, 0] = new SourceGrid.Cells.Cell("Image Alignment"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(viewImage.ImageAlignment, typeof(DevAge.Drawing.ContentAlignment)); grid[currentRow, 1].AddController(new SourceGrid.Cells.Controllers.BindProperty(typeof(SourceGrid.Cells.Views.Cell).GetProperty("ImageAlignment"), viewImage)); currentRow++; grid[currentRow, 0] = new SourceGrid.Cells.Cell("Stretch Image"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(viewImage.ImageStretch, typeof(bool)); grid[currentRow, 1].AddController(new SourceGrid.Cells.Controllers.BindProperty(typeof(SourceGrid.Cells.Views.Cell).GetProperty("ImageStretch"), viewImage)); currentRow++; grid[currentRow, 0] = new SourceGrid.Cells.Cell("Text Alignment"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(viewImage.TextAlignment, typeof(DevAge.Drawing.ContentAlignment)); grid[currentRow, 1].AddController(new SourceGrid.Cells.Controllers.BindProperty(typeof(SourceGrid.Cells.Views.Cell).GetProperty("TextAlignment"), viewImage)); currentRow++; grid[currentRow, 0] = new SourceGrid.Cells.Cell("DrawMode"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell(viewImage.ElementsDrawMode, typeof(DevAge.Drawing.ElementsDrawMode)); grid[currentRow, 1].AddController(new SourceGrid.Cells.Controllers.BindProperty(typeof(SourceGrid.Cells.Views.Cell).GetProperty("ElementsDrawMode"), viewImage)); currentRow++; // Cell VisualModelMultiImages grid[currentRow, 1] = new SourceGrid.Cells.Cell("Multi Images"); SourceGrid.Cells.Views.MultiImages modelMultiImages = new SourceGrid.Cells.Views.MultiImages(); modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image(Properties.Resources.FACE00.ToBitmap())); modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image(Properties.Resources.FACE01.ToBitmap())); modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image(Properties.Resources.FACE02.ToBitmap())); modelMultiImages.SubImages.Add(new DevAge.Drawing.VisualElements.Image(Properties.Resources.FACE04.ToBitmap())); modelMultiImages.SubImages[0].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.TopLeft, false); modelMultiImages.SubImages[1].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.TopRight, false); modelMultiImages.SubImages[2].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.BottomLeft, false); modelMultiImages.SubImages[3].AnchorArea = new DevAge.Drawing.AnchorArea(DevAge.Drawing.ContentAlignment.BottomRight, false); modelMultiImages.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleCenter; grid[currentRow, 1].View = modelMultiImages; grid.Rows[currentRow].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; grid.Rows[currentRow].Height = 50; currentRow++; // Cell Rotated Text grid[currentRow, 0] = new SourceGrid.Cells.Cell("Rotated by angle"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("Rotated Text", typeof(string)); SourceGrid.Cells.Views.Cell rotateView = new SourceGrid.Cells.Views.Cell(); rotateView.ElementText = new RotatedText(45); grid[currentRow, 1].View = rotateView; grid.Rows[currentRow].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize; grid.Rows[currentRow].Height = 50; currentRow++; // GDI+ Text grid[currentRow, 0] = new SourceGrid.Cells.Cell("GDI+ Text"); grid[currentRow, 0].View = captionModel; grid[currentRow, 1] = new SourceGrid.Cells.Cell("Hello from GDI+", typeof(string)); GDITextView gdiTextView = new GDITextView(); gdiTextView.FormatFlags = StringFormatFlags.DirectionVertical | StringFormatFlags.NoWrap; grid[currentRow, 1].View = gdiTextView; currentRow++; #endregion grid.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default; grid.Columns[1].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default; grid.Columns[2].AutoSizeMode = SourceGrid.AutoSizeMode.MinimumSize | SourceGrid.AutoSizeMode.Default; grid.MinimumWidth = 50; grid.AutoSizeCells(); grid.AutoStretchColumnsToFitWidth = true; grid.Columns.StretchToFit(); }
private void frmSampleGrid1_Load(object sender, System.EventArgs e) { string[] l_CountryList = new string[]{"Italy","France","Spain","UK","Argentina","Mexico", "Switzerland", "Brazil", "Germany","Portugal","Sweden","Austria"}; grid1.RowsCount = 1; grid1.ColumnsCount = 10; grid1.FixedRows = 1; grid1.FixedColumns = 1; grid1.SelectionMode = SourceGrid.GridSelectionMode.Row; grid1.AutoStretchColumnsToFitWidth = true; grid1.Columns[0].AutoSizeMode = SourceGrid.AutoSizeMode.None; grid1.Columns[0].Width = 25; grid1.Controller.AddController(new KeyDeleteController()); //TODO ////Enable Drag and Drop //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrag.Cut); //grid1.GridController.AddController(SourceGrid.Controllers.SelectionDrop.Default); #region Create Grid Style, Views and Controllers //Views mView_Price = new SourceGrid.Cells.Views.Cell(); mView_Price.TextAlignment = DevAge.Drawing.ContentAlignment.MiddleRight; mController_Link = new SourceGrid.Cells.Controllers.Button(); mController_Link.Executed += new EventHandler(mController_Link_Click); #endregion #region Create Header Row and Editor SourceGrid.Cells.Header l_00Header = new SourceGrid.Cells.Header(null); grid1[0,0] = l_00Header; mEditor_Id = SourceGrid.Cells.Editors.Factory.Create(typeof(int)); mEditor_Id.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,1] = new SourceGrid.Cells.ColumnHeader("ID (int)"); mEditor_Name = SourceGrid.Cells.Editors.Factory.Create(typeof(string)); mEditor_Name.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,2] = new SourceGrid.Cells.ColumnHeader("NAME (string)"); mEditor_Address = SourceGrid.Cells.Editors.Factory.Create(typeof(string)); mEditor_Address.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,3] = new SourceGrid.Cells.ColumnHeader("ADDRESS (string)"); mEditor_City = SourceGrid.Cells.Editors.Factory.Create(typeof(string)); mEditor_City.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,4] = new SourceGrid.Cells.ColumnHeader("CITY (string)"); mEditor_BirthDay = SourceGrid.Cells.Editors.Factory.Create(typeof(DateTime)); mEditor_BirthDay.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,5] = new SourceGrid.Cells.ColumnHeader("BIRTHDATE (DateTime)"); mEditor_Country = new SourceGrid.Cells.Editors.ComboBox(typeof(string),l_CountryList,false); mEditor_Country.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,6] = new SourceGrid.Cells.ColumnHeader("COUNTRY (string + combobox)"); mEditor_Price = new SourceGrid.Cells.Editors.TextBoxCurrency(typeof(double)); mEditor_Price.EditableMode = SourceGrid.EditableMode.Focus|SourceGrid.EditableMode.AnyKey|SourceGrid.EditableMode.SingleClick; grid1[0,7] = new SourceGrid.Cells.ColumnHeader("$ PRICE (double)"); grid1[0,8] = new SourceGrid.Cells.ColumnHeader("Selected"); grid1[0,9] = new SourceGrid.Cells.ColumnHeader("WebSite"); #endregion //Read Data From xml System.IO.StreamReader reader = new System.IO.StreamReader(System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("WindowsFormsSample.GridSamples.SampleData.xml")); System.Xml.XmlDocument xmlDoc = new System.Xml.XmlDocument(); xmlDoc.LoadXml(reader.ReadToEnd()); reader.Close(); System.Xml.XmlNodeList rows = xmlDoc.SelectNodes("//row"); grid1.RowsCount = rows.Count+1; int rowsCount = 1; foreach(System.Xml.XmlNode l_Node in rows) { #region Pupulate RowsCount grid1[rowsCount,0] = new SourceGrid.Cells.RowHeader(null); grid1[rowsCount,1] = new SourceGrid.Cells.Cell(rowsCount, mEditor_Id); grid1[rowsCount,2] = new SourceGrid.Cells.Cell(l_Node.Attributes["ContactName"].InnerText, mEditor_Name); grid1[rowsCount,3] = new SourceGrid.Cells.Cell(l_Node.Attributes["Address"].InnerText, mEditor_Address); grid1[rowsCount,4] = new SourceGrid.Cells.Cell(l_Node.Attributes["City"].InnerText, mEditor_City); grid1[rowsCount,5] = new SourceGrid.Cells.Cell(DateTime.Today, mEditor_BirthDay); grid1[rowsCount,6] = new SourceGrid.Cells.Cell(l_Node.Attributes["Country"].InnerText, mEditor_Country); grid1[rowsCount,7] = new SourceGrid.Cells.Cell(25.0, mEditor_Price); grid1[rowsCount, 7].View = mView_Price; grid1[rowsCount,8] = new SourceGrid.Cells.CheckBox(null, false); grid1[rowsCount,9] = new SourceGrid.Cells.Link(l_Node.Attributes["website"].InnerText); grid1[rowsCount,9].AddController(mController_Link); #endregion rowsCount++; } grid1.AutoSizeCells(); }
public static void CreateSample(ref Grid grid1) { //Border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkKhaki, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); //Views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.Khaki, Color.DarkKhaki); viewNormal.Border = cellBorder; CheckBoxBackColorAlternate viewCheckBox = new CheckBoxBackColorAlternate(Color.Khaki, Color.DarkKhaki); viewCheckBox.Border = cellBorder; //ColumnHeader view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.Maroon; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Comic Sans MS", 10, FontStyle.Underline); //Editors SourceGrid.Cells.Editors.TextBox editorString = new SourceGrid.Cells.Editors.TextBox(typeof(string)); SourceGrid.Cells.Editors.TextBoxUITypeEditor editorDateTime = new SourceGrid.Cells.Editors.TextBoxUITypeEditor(typeof(DateTime)); //Create the grid grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("String"); columnHeader.View = viewColumnHeader; grid1[0, 0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("DateTime"); columnHeader.View = viewColumnHeader; grid1[0, 1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("CheckBox"); columnHeader.View = viewColumnHeader; grid1[0, 2] = columnHeader; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString()); grid1[r, 0].Editor = editorString; grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today); grid1[r, 1].Editor = editorDateTime; grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 0].View = viewNormal; grid1[r, 1].View = viewNormal; grid1[r, 2].View = viewCheckBox; } grid1.AutoSizeCells(); }
protected override void OnLoad(EventArgs e) { base.OnLoad (e); //Border DevAge.Drawing.BorderLine border = new DevAge.Drawing.BorderLine(Color.DarkKhaki, 1); DevAge.Drawing.RectangleBorder cellBorder = new DevAge.Drawing.RectangleBorder(border, border); //Views CellBackColorAlternate viewNormal = new CellBackColorAlternate(Color.Khaki, Color.DarkKhaki); viewNormal.Border = cellBorder; CheckBoxBackColorAlternate viewCheckBox = new CheckBoxBackColorAlternate(Color.Khaki, Color.DarkKhaki); viewCheckBox.Border = cellBorder; //ColumnHeader view SourceGrid.Cells.Views.ColumnHeader viewColumnHeader = new SourceGrid.Cells.Views.ColumnHeader(); DevAge.Drawing.VisualElements.ColumnHeader backHeader = new DevAge.Drawing.VisualElements.ColumnHeader(); backHeader.BackColor = Color.Maroon; backHeader.Border = DevAge.Drawing.RectangleBorder.NoBorder; viewColumnHeader.Background = backHeader; viewColumnHeader.ForeColor = Color.White; viewColumnHeader.Font = new Font("Comic Sans MS", 10, FontStyle.Underline); //Editors SourceGrid.Cells.Editors.TextBox editorString = new SourceGrid.Cells.Editors.TextBox(typeof(string)); SourceGrid.Cells.Editors.TextBoxUITypeEditor editorDateTime = new SourceGrid.Cells.Editors.TextBoxUITypeEditor(typeof(DateTime)); //Create the grid grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 3; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.ColumnHeader columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("String"); columnHeader.View = viewColumnHeader; grid1[0,0] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("DateTime"); columnHeader.View = viewColumnHeader; grid1[0,1] = columnHeader; columnHeader = new SourceGrid.Cells.ColumnHeader("CheckBox"); columnHeader.View = viewColumnHeader; grid1[0,2] = columnHeader; for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r,0] = new SourceGrid.Cells.Cell("Hello " + r.ToString()); grid1[r,0].Editor = editorString; grid1[r,1] = new SourceGrid.Cells.Cell(DateTime.Today); grid1[r,1].Editor = editorDateTime; grid1[r,2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r,0].View = viewNormal; grid1[r,1].View = viewNormal; grid1[r,2].View = viewCheckBox; } grid1.AutoSizeCells(); }
private void DoFull() { grid1.Redim(20, 12); 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"); grid1[1, 10] = new MyHeader("11"); grid1[1, 11] = new MyHeader("12"); 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(); 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[r, 10] = new SourceGrid.Cells.Cell("Text Span", typeof(string)); grid1[r, 10].ColumnSpan = 2; grid1[r, 10].RowSpan = 2; } grid1.ClipboardMode = SourceGrid.ClipboardMode.All; grid1.AutoSizeCells(); }
private void frmSample14_Load(object sender, System.EventArgs e) { grid1.BorderStyle = BorderStyle.FixedSingle; grid1.ColumnsCount = 4; grid1.FixedRows = 1; grid1.Rows.Insert(0); SourceGrid.Cells.Editors.ComboBox cbEditor = new SourceGrid.Cells.Editors.ComboBox(typeof(string)); cbEditor.StandardValues = new string[]{"Value 1", "Value 2", "Value 3"}; cbEditor.EditableMode = SourceGrid.EditableMode.Focus | SourceGrid.EditableMode.SingleClick | SourceGrid.EditableMode.AnyKey; grid1[0, 0] = new SourceGrid.Cells.ColumnHeader("String"); grid1[0, 1] = new SourceGrid.Cells.ColumnHeader("DateTime"); grid1[0, 2] = new SourceGrid.Cells.ColumnHeader("CheckBox"); grid1[0, 3] = new SourceGrid.Cells.ColumnHeader("ComboBox"); for (int r = 1; r < 10; r++) { grid1.Rows.Insert(r); grid1[r, 0] = new SourceGrid.Cells.Cell("Hello " + r.ToString(), typeof(string)); grid1[r, 1] = new SourceGrid.Cells.Cell(DateTime.Today, typeof(DateTime)); grid1[r, 2] = new SourceGrid.Cells.CheckBox(null, true); grid1[r, 3] = new SourceGrid.Cells.Cell("Value 1", cbEditor); grid1[r, 3].View = SourceGrid.Cells.Views.ComboBox.Default; } 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(); }
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 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 addRowToDownloadGrid(Download download) { PopupMenu menuController = new PopupMenu(this); int insertRowCount = downloadGrid.Rows.Count; download.RowIndex = insertRowCount; downloadGrid.Rows.Insert(insertRowCount); downloadGrid[insertRowCount, 0] = new SourceGrid.Cells.CheckBox(null, download.DownloadEnable); downloadGrid[insertRowCount, 0].View = viewCheckBox; downloadGrid[insertRowCount, 0].AddController(menuController); downloadGrid[insertRowCount, 0].Controller.RemoveController(downloadGrid[insertRowCount, 0].FindController<SourceGrid.Cells.Controllers.CheckBox>()); downloadGrid[insertRowCount, 0].Controller.AddController(new SourceGrid.Cells.Controllers.CheckBox(false)); downloadGrid[insertRowCount, 0].FindController<SourceGrid.Cells.Controllers.CheckBox>().CheckedChanged += ChangeActivateCheckBox(insertRowCount); downloadGrid[insertRowCount, 1] = new SourceGrid.Cells.Cell(download.No); downloadGrid[insertRowCount, 1].View = viewNormal; downloadGrid[insertRowCount, 1].AddController(menuController); downloadGrid[insertRowCount, 2] = new SourceGrid.Cells.Cell(download.Ip); downloadGrid[insertRowCount, 2].View = viewNormal; downloadGrid[insertRowCount, 2].AddController(menuController); downloadGrid[insertRowCount, 3] = new SourceGrid.Cells.Cell(Path.GetFileName(download.DownloadFileName)); downloadGrid[insertRowCount, 3].View = viewNormal; downloadGrid[insertRowCount, 3].AddController(menuController); ProgressBar progressBar = new ProgressBar(); progressBar.BackColor = Color.Gray; progressBar.ForeColor = Color.DarkSlateGray; progressBar.Value = 0; SourceGrid.Cells.Cell cell = new SourceGrid.Cells.Cell(download.Progress); downloadGrid[insertRowCount, 4] = cell; downloadGrid[insertRowCount, 4].View = viewNormal; downloadGrid[insertRowCount, 4].AddController(menuController); SourceGrid.LinkedControlValue linkedControlValue = new SourceGrid.LinkedControlValue(progressBar, new SourceGrid.Position(insertRowCount, 4)); downloadGrid.LinkedControls.Add(linkedControlValue); SourceGrid.Cells.Views.Cell statusCell = new SourceGrid.Cells.Views.Cell(); statusCell.Border = cellBorder; statusCell.Font = new Font("돋음", 8, FontStyle.Regular); statusCell.BackColor = download.Status.ColorParse(); SourceGrid.Cells.Cell cell5 = new SourceGrid.Cells.Cell(download.Status.Parse()); downloadGrid[insertRowCount, 5] = cell5; downloadGrid[insertRowCount, 5].View = statusCell; downloadGrid[insertRowCount, 5].AddController(menuController); DownLoadBinding binding = new DownLoadBinding(); binding.ProgressBar = progressBar; binding.Cell = cell5; binding.StatusCell = statusCell; downloadGrid.Rows[insertRowCount].Tag = binding; }