DataGridColumnStyle

DataGridColumnStyle marshal by reference, disposable

System. Windows .Forms (system. windows .forms.dll) abstract class

DataGridColumnStyle objects tell the data grid how to manage and display a particular column of data. First, you can specify the name of the data member to which this particular column is bound using the MappingName property. Note that you can only have one column per unique mapping. Then, specify the column HeaderText , the Alignment of the column text, and the Width of the column.

While various column style objects are provided by the system (such as DataGridBoolColumn and DataGridTextBoxColumn ), you can derive your own to provide custom display and/or editing facilities.

You can override the Paint() method to provide custom rendering. Editing is initiated with the Edit() method, giving you the opportunity to show your own editing control, and Abort() is called if the grid wants you to attempt to abandon editing. If you need control over the row height, you can override GetMinimumHeight() , GetPreferredHeight() , and GetPreferredSize() to indicate to the system the requirements for this particular column.

 public abstract class  DataGridColumnStyle  : System.ComponentModel.Component : IDataGridColumnStyleEditingNotificationService {  // Public Constructors  public  DataGridColumnStyle  ();    public  DataGridColumnStyle  (System.ComponentModel.PropertyDescriptor  prop  );  // Public Instance Properties  public virtual HorizontalAlignment  Alignment  {set; get; }    public virtual DataGridTableStyle  DataGridTableStyle  {get; }    public AccessibleObject  HeaderAccessibleObject  {get; }    public virtual string  HeaderText  {set; get; }    public string  MappingName  {set; get; }    public virtual string  NullText  {set; get; }    public virtual PropertyDescriptor  PropertyDescriptor  {set; get; }    public virtual bool  ReadOnly  {set; get; }    public virtual int  Width  {set; get; }  // Protected Instance Properties  protected int  FontHeight  {get; }  // Public Instance Methods  public void  ResetHeaderText  ();  // Protected Instance Methods  protected internal abstract void  Abort  (int  rowNum  );    protected void  BeginUpdate  ();    protected void  CheckValidDataSource  (CurrencyManager  value  );    protected internal virtual void  ColumnStartedEditing  (         Control  editingControl  );  // implements IDataGridColumnStyleEditingNotificationService  protected internal abstract bool  Commit  (CurrencyManager  dataSource  , int  rowNum  );    protected internal virtual void  ConcedeFocus  ();    protected virtual AccessibleObject  CreateHeaderAccessibleObject  ();    protected internal virtual void  Edit  (CurrencyManager  source  , int  rowNum  , System.Drawing.Rectangle  bounds  ,           bool  readOnly  );    protected internal virtual void  Edit  (CurrencyManager  source  , int  rowNum  , System.Drawing.Rectangle  bounds  ,          bool  readOnly  , string  instantText  );    protected internal abstract void  Edit  (CurrencyManager  source  , int  rowNum  , System.Drawing.Rectangle  bounds  ,          bool  readOnly  , string  instantText  , bool  cellIsVisible  );    protected void  EndUpdate  ();    protected internal virtual void  EnterNullValue  ();    protected internal virtual object  GetColumnValueAtRow  (CurrencyManager  source  , int  rowNum  );    protected internal abstract int  GetMinimumHeight  ();    protected internal abstract int  GetPreferredHeight  (System.Drawing.Graphics  g  , object  value  );    protected internal abstract Size  GetPreferredSize  (System.Drawing.Graphics  g  , object  value  );    protected virtual void  Invalidate  ();    protected internal abstract void  Paint  (System.Drawing.Graphics  g  , System.Drawing.Rectangle  bounds  ,         CurrencyManager  source  , int  rowNum  );    protected internal abstract void  Paint  (System.Drawing.Graphics  g  , System.Drawing.Rectangle  bounds  ,          CurrencyManager  source  , int  rowNum  , bool  alignToRight  );    protected internal virtual void  Paint  (System.Drawing.Graphics  g  , System.Drawing.Rectangle  bounds  ,         CurrencyManager  source  , int  rowNum  , System.Drawing.Brush  backBrush  , System.Drawing.Brush  foreBrush  ,          bool  alignToRight  );    protected internal virtual void  SetColumnValueAtRow  (CurrencyManager  source  , int  rowNum  , object  value  );    protected virtual void  SetDataGrid  (DataGrid  value  );    protected virtual void  SetDataGridInColumn  (DataGrid  value  );    protected internal virtual void  UpdateUI  (CurrencyManager  source  , int  rowNum  , string  instantText  );  // Events  public event EventHandler  AlignmentChanged  ;    public event EventHandler  FontChanged  ;    public event EventHandler  HeaderTextChanged  ;    public event EventHandler  MappingNameChanged  ;    public event EventHandler  NullTextChanged  ;    public event EventHandler  PropertyDescriptorChanged  ;    public event EventHandler  ReadOnlyChanged  ;    public event EventHandler  WidthChanged  ; } 

Hierarchy

System.Object System.MarshalByRefObject System.ComponentModel.Component(System.ComponentModel.IComponen, System.IDisposable) DataGridColumnStyle(IDataGridColumnStyleEditingNotificationService)

Subclasses

DataGridBoolColumn , DataGridTextBoxColumn

Returned By

DataGrid.CreateGridColumn() , GridColumnStylesCollection.this

Passed To

DataGrid.{BeginEdit() , EndEdit()} , DataGridTableStyle.{BeginEdit() , EndEdit()} , GridColumnStylesCollection.{Add() , AddRange( ) , Contains() , IndexOf( ) , Remove()} , IDataGridEditingService.{BeginEdit() , EndEdit()}



. Net Windows Forms in a Nutshell
.NET Windows Forms in a Nutshell
ISBN: 0596003382
EAN: 2147483647
Year: 2002
Pages: 794

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net