public FrmGridContainer() { InitializeComponent(); _formatEngine = new ConditionalFormatEngine(); lblShowing.Enabled = false; grid.OnPageChange = () => lblShowing.Text = string.Format("Shoing page {0} out of {1}", grid.CurrentPage + 1, grid.TotalPages()); btnFirst.Click += delegate { grid.OnGotoFirst(); }; btnPrev.Click += delegate { grid.OnGotoPrev(); }; btnNext.Click += delegate { grid.OnGotoNext(); }; btnLast.Click += delegate { grid.OnGotoLast(); }; }
public PowerGridControl() { _formatEngine = new ConditionalFormatEngine(); _conditionalFormats = new List <ConditionalFormat>(); _userSelectedFormats = new List <ConditionalFormat>(); RegisterDefaultConditionalFormats(); ReadOnly = true; SelectionMode = DataGridViewSelectionMode.FullRowSelect; AllowUserToAddRows = false; AllowUserToDeleteRows = false; AllowUserToOrderColumns = false; MultiSelect = false; UpperBound = 100; SuspendLayout(); RowPrePaint += (s, e) => { if (e.RowIndex < 0 || Rows[e.RowIndex].Tag != null) { return; } //User defined formats take precedence over built in formats. if (!ApplyUserDefinedFormat(Rows[e.RowIndex])) { foreach (var cf in _conditionalFormats) { Rows[e.RowIndex].DefaultCellStyle.Font = new Font("Segoe UI", 9f); if (!_formatEngine.Eval(cf.Condition, Rows[e.RowIndex])) { continue; } Rows[e.RowIndex].DefaultCellStyle.BackColor = cf.Format.BackgroundColor; Rows[e.RowIndex].DefaultCellStyle.ForeColor = cf.Format.ForeColor; } } //Avoid painting the same row twice. Rows[e.RowIndex].Tag = "already painted"; ResumeLayout(true); }; }
public PowerGridControl() { _formatEngine = new ConditionalFormatEngine(); _conditionalFormats = new List<ConditionalFormat>(); _userSelectedFormats = new List<ConditionalFormat>(); RegisterDefaultConditionalFormats(); ReadOnly = true; SelectionMode = DataGridViewSelectionMode.FullRowSelect; AllowUserToAddRows = false; AllowUserToDeleteRows = false; AllowUserToOrderColumns = false; MultiSelect = false; UpperBound = 100; SuspendLayout(); RowPrePaint += (s, e) => { if (e.RowIndex < 0 || Rows[e.RowIndex].Tag != null) return; //User defined formats take precedence over built in formats. if (!ApplyUserDefinedFormat(Rows[e.RowIndex])) { foreach (var cf in _conditionalFormats) { Rows[e.RowIndex].DefaultCellStyle.Font = new Font("Segoe UI", 9f); if (!_formatEngine.Eval(cf.Condition, Rows[e.RowIndex])) continue; Rows[e.RowIndex].DefaultCellStyle.BackColor = cf.Format.BackgroundColor; Rows[e.RowIndex].DefaultCellStyle.ForeColor = cf.Format.ForeColor; } } //Avoid painting the same row twice. Rows[e.RowIndex].Tag = "already painted"; ResumeLayout(true); }; }
public Session CreateSession(ConditionalFormatEngine engine, Type type) { return(new Session()); }
public Session CreateSession(ConditionalFormatEngine engine, Type type) { return new Session(); }