public override object EditValue(ITypeDescriptorContext context, System.IServiceProvider provider, object value) { IWindowsFormsEditorService svc = null; if (provider != null) { svc = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService)); } if (svc != null) { if (context.Instance is ABCGridControl) { ABCGridControl grid = context.Instance as ABCGridControl; using (GridColumnConfigForm form = new GridColumnConfigForm(grid.DefaultView.ColumnConfigs)) { form.TableName = grid.TableName; form.Script = grid.Script; if (svc.ShowDialog(form) == DialogResult.OK) { grid.DefaultView.ColumnConfigs = form.ColumnList; grid.DefaultView.InitColumns(); } } } } return(value); }
void ABCCheckEdit_CheckStateChanged(object sender, EventArgs e) { if (OwnerView != null && OwnerView.Mode != ViewMode.Design && String.IsNullOrWhiteSpace(GridControl) == false) { Control[] controls = OwnerView.Controls.Find(GridControl, true); if (controls.Length > 0) { if (controls[0] is ABCGridControl) { ABCGridControl grid = controls[0] as ABCGridControl; if (grid.GridDefaultView.Columns[ABCCommon.ABCConstString.colSelected] != null) { if (grid.GridDataSource is System.Windows.Forms.BindingSource && (grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource is System.Collections.IList) { foreach (BusinessObject obj in ((grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource as System.Collections.IList)) { ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colSelected, this.CheckState == System.Windows.Forms.CheckState.Checked); } } } } if (controls[0] is ABCGridBandedControl) { ABCGridBandedControl grid = controls[0] as ABCGridBandedControl; if (grid.BandedView.Columns[ABCCommon.ABCConstString.colSelected] != null) { if (grid.GridDataSource is System.Windows.Forms.BindingSource && (grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource is System.Collections.IList) { foreach (BusinessObject obj in ((grid.GridDataSource as System.Windows.Forms.BindingSource).DataSource as System.Collections.IList)) { ABCDynamicInvoker.SetValue(obj, ABCCommon.ABCConstString.colSelected, this.CheckState == System.Windows.Forms.CheckState.Checked); } } } } } } }