private void dataGridEh1RegionColumn_DataCellManagerNeeded(object sender, DataGridDataCellManagerNeededEventArgs e) { object val = dataGridEh1CountryColumn.GetRowValue(e.Row); if (!EhLibUtils.DBValueEqual("USA", val)) { e.CellManager = blankCell; } }
private void dataGridTextColumn3_DataCellFormatParamsNeeded(object sender, DataGridDataCellFormatParamsNeededEventArgs e) { if (e.Row == null) { return; } if (EhLibUtils.DBValueEqual(e.Column.GetRowValue(e.Row), "North America")) { e.CellArgs.Font = new Font(e.CellArgs.Font, FontStyle.Bold); } }
private string ObjectToString(object v) { if (EhLibUtils.DBValueEqual(v, null)) { return(""); } else { return(v.ToString()); } }
private void dataGridEh1_TreeView_NewNodeInit(object sender, EhLib.WinForms.DataGridTreeViewNewNodeInitEventArgs e) { DataRowView rowView = e.Row.SourceItem as DataRowView; object ExpandedObj = rowView["Expanded"]; if (!EhLibUtils.DBValueEqual(ExpandedObj, null) && (int)ExpandedObj == 1) { e.Node.Expanded = true; } else { e.Node.Expanded = false; } }
/// <summary> /// columnUnitPrice.Footer.RowStepCalculation event handler /// Calculate custCalculator step for one Row /// </summary> private void columnUnitPrice_Footer_RowStepCalculation(object sender, DataGridFooterCalculationEventArgs e) { if (e.FooterItemIndex == 1) { object upVal = columnUnitPrice.GetRowValue(e.Row); object qnVal = columnQuantity.GetRowValue(e.Row); if (!EhLibUtils.DBValueEqual(upVal, null) && !EhLibUtils.DBValueEqual(qnVal, null)) { Decimal upv = Convert.ToDecimal(upVal); Decimal qnv = Convert.ToDecimal(qnVal); Decimal decVal = upv * qnv; custCalculator.StepCalcData(decVal); } } }
private void dataGridProgressBarColumn1_DataCellDisplayValueNeeded(object sender, DataGridDataCellDisplayValueNeededEventArgs e) { if (!EhLibUtils.DBValueEqual(e.CellArgs.Value, null)) { double dValue = (double)(Decimal)e.CellArgs.Value; if (dValue > dataGridProgressBarColumn4.MaxValue) { e.CellArgs.DisplayValue = ">100%"; e.Handled = true; } else if (dValue > 0 && dValue < dataGridProgressBarColumn4.MaxValue / 100 / 2) { e.CellArgs.DisplayValue = "<1%"; e.Handled = true; } } }
private void DataGrid1_HorzLineParamsNeeded(object sender, DataGridHorzLineParamsNeededEventArgs e) { object sortedVal; object nextSortedVal; DataGridRow nextRow; if (e.Row == null) { return; } DataGridColumn sortedCol; if (dataGrid1.Title.SortMarking.SortMarkers.Count > 0) { sortedCol = dataGrid1.Title.SortMarking.SortMarkers[0].Column; if (e.Row.VisibleIndex < dataGrid1.VisibleRows.Count - 1) { sortedVal = sortedCol.GetRowValue(e.Row); nextRow = dataGrid1.VisibleRows[e.Row.VisibleIndex + 1]; nextSortedVal = sortedCol.GetRowValue(nextRow); if (!EhLibUtils.DBValueEqual(sortedVal, nextSortedVal)) { e.Style = DashStyle.Solid; e.Color = dataGrid1.LineOptions.DarkColor; } } else if (e.Row.VisibleIndex == dataGrid1.VisibleRows.Count - 1) { e.Style = DashStyle.Solid; e.Color = dataGrid1.LineOptions.DarkColor; } } }