private void FormatValue(System.Windows.Forms.DataGridViewCell cell, object value) { if (cell.Value == null) { cell.Value = value; } }
private void optionCellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) // double click { if (e.RowIndex <= -1 || e.ColumnIndex <= -1) { return; } System.Windows.Forms.DataGridViewCell cell = optionsTable.Rows[e.RowIndex].Cells[e.ColumnIndex]; Console.WriteLine("cella: " + cell); string worker = ""; string robot = ""; string key; List <Index> indexList = new List <Index>(); if (cell.Value != null && (cell.Value.ToString() != 0.ToString() || cell.ColumnIndex != 0 || cell.RowIndex != 0)) { worker = optionsTable.Columns[cell.ColumnIndex].HeaderCell.Value.ToString(); robot = optionsTable.Rows[cell.RowIndex].HeaderCell.Value.ToString(); key = robot + "," + worker; Console.WriteLine("kattintott: " + key); indexList = combinationMap[key].First().Key; showSol = new ShowSolution(ref tables, ref indexList, worker, robot); showSolList.Add(showSol); showSol.Show(); } }
bool readStrFromCell(System.Windows.Forms.DataGridViewCell cell, out string r) { bool result = true; if (cell.Value != null) { r = cell.Value.ToString(); } else { r = ""; result = false; } return(result); }
public void TestWinRowIsRefreshed() { //---------------Set up test pack------------------- BusinessObjectCollection <MyBO> col; IGridBase gridBase = GetGridBaseWith_4_Rows(out col); MyBO bo = col[0]; //---------------Execute Test ---------------------- const string propName = "TestProp"; bo.SetPropertyValue(propName, "UpdatedValue"); //---------------Test Result ----------------------- gridBase.SelectedBusinessObject = bo; //System.Windows.Forms.DataGridViewRow row = (System.Windows.Forms.DataGridViewRow) gridBase.Rows[0]; //System.Windows.Forms.DataGridViewCell cell = row.Cells[propName]; System.Windows.Forms.DataGridViewCell cell = GetCell(0, propName, gridBase); Assert.AreEqual("UpdatedValue", cell.Value); }
bool readIntFromCell(System.Windows.Forms.DataGridViewCell cell, out string i) { int temp = 0; i = "null"; if (cell.Value != null) { if (int.TryParse(cell.Value.ToString(), out temp)) { i = cell.Value.ToString(); } else if (cell.Value.ToString() != "") { return(false); } } else { return(false); } return(true); }
private bool conv(System.Windows.Forms.DataGridViewCell cell, out UInt64 num) { num = 0; if ((cell == null) || (cell.Value == null) || (cell.Value.ToString() == "")) { return(false); } string str = cell.Value.ToString(); int fromBase = 10; if ((str.IndexOf("0x") == 0) || (str.IndexOf("0X") == 0)) { fromBase = 16; } try { num = Convert.ToUInt64(str, fromBase /* 16 or 10 */); } catch (Exception e) { } return(true); }
public DataGridViewCellLinkedListElement(System.Windows.Forms.DataGridViewCell dataGridViewCell) { this.dataGridViewCell = dataGridViewCell; }
private void LeftView_CurrentCellChanged(System.Windows.Forms.DataGridViewCell cell) { this.rightView.SetCurrentCell(cell); }
private void cellClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) // single click { System.Drawing.Color yellow = System.Drawing.Color.Yellow; System.Drawing.Color green = System.Drawing.Color.Green; System.Drawing.Color white = System.Drawing.Color.White; System.Drawing.Color aqua = System.Drawing.Color.Aqua; System.Drawing.Color lightBlue = System.Drawing.Color.LightBlue; System.Drawing.Color control = System.Drawing.SystemColors.Control; System.Drawing.Color yellow2 = System.Drawing.ColorTranslator.FromHtml("#ffffcc"); if (e.RowIndex <= -1 || e.ColumnIndex <= -1) // clicked on headers { return; } if (prevSelectedCol != -1 && prevSelectedRow != -1) // remove previous selection if any { for (int i = 0; i < prevSelectedRow; ++i) { if (optionsTable.Rows[i].Cells[prevSelectedCol].Style.BackColor != yellow && optionsTable.Rows[i].Cells[prevSelectedCol].Style.BackColor != green) { optionsTable.Rows[i].Cells[prevSelectedCol].Style.BackColor = white; } } for (int i = 0; i < prevSelectedCol; ++i) { if (optionsTable.Rows[prevSelectedRow].Cells[i].Style.BackColor != yellow && optionsTable.Rows[prevSelectedRow].Cells[i].Style.BackColor != green) { optionsTable.Rows[prevSelectedRow].Cells[i].Style.BackColor = white; } } if (optionsTable.Rows[prevSelectedRow].HeaderCell.Style.BackColor != yellow) { optionsTable.Rows[prevSelectedRow].HeaderCell.Style.BackColor = control; } if (optionsTable.Columns[prevSelectedCol].HeaderCell.Style.BackColor != yellow) { optionsTable.Columns[prevSelectedCol].HeaderCell.Style.BackColor = control; } } System.Windows.Forms.DataGridViewCell cell = optionsTable.Rows[e.RowIndex].Cells[e.ColumnIndex]; // clicked cell for (int i = 0; i < e.RowIndex; ++i) { if (optionsTable.Rows[i].Cells[e.ColumnIndex].Style.BackColor != yellow && optionsTable.Rows[i].Cells[e.ColumnIndex].Style.BackColor != green) { optionsTable.Rows[i].Cells[e.ColumnIndex].Style.BackColor = lightBlue; } } for (int i = 0; i < e.ColumnIndex; ++i) { if (optionsTable.Rows[e.RowIndex].Cells[i].Style.BackColor != yellow && optionsTable.Rows[e.RowIndex].Cells[i].Style.BackColor != green) { optionsTable.Rows[e.RowIndex].Cells[i].Style.BackColor = lightBlue; } } prevSelectedRow = e.RowIndex; prevSelectedCol = e.ColumnIndex; if (optionsTable.Rows[e.RowIndex].HeaderCell.Style.BackColor != yellow) { optionsTable.Rows[e.RowIndex].HeaderCell.Style.BackColor = lightBlue; } if (optionsTable.Columns[e.ColumnIndex].HeaderCell.Style.BackColor != yellow) { optionsTable.Columns[e.ColumnIndex].HeaderCell.Style.BackColor = lightBlue; } }
public DataGridViewCellLinkedListElement(System.Windows.Forms.DataGridViewCell dataGridViewCell) { this.dataGridViewCell = dataGridViewCell; }
private void journalfilterdatagrid_CellEndEdit(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) { System.Windows.Forms.DataGridViewCell cell = journalfilterdatagrid.Rows[e.RowIndex].Cells[e.ColumnIndex]; cell.Value = cell.Value.ToString().ToLower(); RazorEnhanced.Filters.CopyJournalFilterTable(); }