WinForms

Upgrade Guide User Guide Demos Support Forums Download
  • Upgrade Guide
  • User Guide
  • Demos
  • Support
  • Forums
  • Download
Class TableControl - WindowsForms API Reference | Syncfusion

    Show / Hide Table of Contents

    Class TableControl

    Represents a control that displays the data in a tabular format

    Inheritance
    System.Object
    BaseControl
    SfScrollControl
    TableControl
    Implements
    IThemeProvider
    IVisualStyle
    System.IDisposable
    ISupportUpdate
    Inherited Members
    SfScrollControl.BeginUpdate()
    SfScrollControl.EndUpdate()
    SfScrollControl.OnThemeNameChanged(String)
    SfScrollControl.GetControlName(String)
    SfScrollControl.WndProc(Message)
    SfScrollControl.RaiseThemeChanged(Object, ThemeChangedEventArgs)
    SfScrollControl.OnParentChanged(EventArgs)
    SfScrollControl.OnMouseDown(MouseEventArgs)
    SfScrollControl.OnMouseUp(MouseEventArgs)
    SfScrollControl.OnMouseMove(MouseEventArgs)
    SfScrollControl.OnMouseLeave(EventArgs)
    SfScrollControl.OnMouseHover(EventArgs)
    SfScrollControl.OnInvalidated(InvalidateEventArgs)
    SfScrollControl.OnEnter(EventArgs)
    SfScrollControl.OnLeave(EventArgs)
    SfScrollControl.OnValidating(CancelEventArgs)
    SfScrollControl.OnValidated(EventArgs)
    SfScrollControl.OnLostFocus(EventArgs)
    SfScrollControl.OnGotFocus(EventArgs)
    SfScrollControl.OnControlRemoved(ControlEventArgs)
    SfScrollControl.OnControlAdded(ControlEventArgs)
    SfScrollControl.OnLocationChanged(EventArgs)
    SfScrollControl.OnHandleCreated(EventArgs)
    SfScrollControl.OnVisibleChanged(EventArgs)
    SfScrollControl.OnDragOver(DragEventArgs)
    SfScrollControl.OnRightToLeftChanged(EventArgs)
    SfScrollControl.StartAutoScrollTimer(Message)
    SfScrollControl.StartAutoScrollTimer(Message, TimeSpan)
    SfScrollControl.ScrollWindowInvalidate(Rectangle)
    SfScrollControl.OnBeginAutoScroll(BeginAutoScrollEventArgs)
    SfScrollControl.OnEndAutoScroll(EventArgs)
    SfScrollControl.OnWindowScrolled(ScrollWindowEventArgs)
    SfScrollControl.OnWindowScrolling(ScrollWindowEventArgs)
    SfScrollControl.OnControlGotFocus()
    SfScrollControl.OnControlLostFocus()
    SfScrollControl.AutoScrollMode
    SfScrollControl.VerticalScroll
    SfScrollControl.HorizontalScroll
    SfScrollControl.AutoScrollBounds
    SfScrollControl.AutoScrollMargin
    SfScrollControl.Style
    SfScrollControl.HorizontalScrollBarVisible
    SfScrollControl.VerticalScrollBarVisible
    SfScrollControl.AllowReaderModeScrolling
    SfScrollControl.IsUpdating
    SfScrollControl.ClientRectangle
    SfScrollControl.ClientSize
    SfScrollControl.AutoScrollInterval
    SfScrollControl.AccessibilityEnabled
    SfScrollControl.CreateParams
    SfScrollControl.AllowAutoScroll
    SfScrollControl.Scroll
    SfScrollControl.BeginAutoScroll
    SfScrollControl.EndAutoScroll
    SfScrollControl.WindowScrolled
    SfScrollControl.WindowScrolling
    SfScrollControl.ThemeChanged
    BaseControl.GetActiveThemeName()
    BaseControl.OnCanApplyThemeChanged(Boolean)
    BaseControl.OnCanOverrideStyleChanged(Boolean)
    BaseControl.ThemeName
    BaseControl.CanOverrideStyle
    BaseControl.IThemeProvider.BaseThemeName
    BaseControl.CanApplyTheme
    BaseControl.ControlName
    BaseControl.IVisualStyle.VisualTheme
    BaseControl.IsVisualStyleEnabled
    BaseControl.ThemeNameChanged
    Namespace: Syncfusion.WinForms.DataGrid
    Assembly: Syncfusion.SfDataGrid.WinForms.dll
    Syntax
    public class TableControl : SfScrollControl, IThemeProvider, IVisualStyle, IDisposable, ISupportUpdate

    Constructors

    TableControl(SfDataGrid)

    Initializes a new instance of the TableControl class.

    Declaration
    public TableControl(SfDataGrid sfDataGrid)
    Parameters
    Type Name Description
    SfDataGrid sfDataGrid

    The sFDataGrid.

    Properties

    ColumnWidths

    Gets the collection of the column widths.

    Declaration
    public IPaddedEditableLineSizeHost ColumnWidths { get; }
    Property Value
    Type Description
    IPaddedEditableLineSizeHost

    DefaultSize

    Overridden to set the default size of the TableControl.

    Declaration
    protected override Size DefaultSize { get; }
    Property Value
    Type Description
    System.Drawing.Size

    HorizontalScrollIncrement

    Gets or sets the multiplier for horizontal mouse wheel scrolling.

    Declaration
    public override int HorizontalScrollIncrement { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    SfScrollControl.HorizontalScrollIncrement

    RowHeightManager

    Gets or sets the row height manager for the SfDataGrid.

    Declaration
    public RowHeightManager RowHeightManager { get; set; }
    Property Value
    Type Description
    RowHeightManager

    RowHeights

    Gets the collection of the row heights.

    Declaration
    public IPaddedEditableLineSizeHost RowHeights { get; }
    Property Value
    Type Description
    IPaddedEditableLineSizeHost

    ScrollColumns

    Gets the collection of visible columns.

    Declaration
    public ScrollAxisBase ScrollColumns { get; }
    Property Value
    Type Description
    ScrollAxisBase

    ScrollRows

    Gets the collection of visible rows.

    Declaration
    public ScrollAxisBase ScrollRows { get; }
    Property Value
    Type Description
    ScrollAxisBase

    VerticalScrollIncrement

    Gets or sets the multiplier for vertical mouse wheel scrolling.

    Declaration
    public override int VerticalScrollIncrement { get; set; }
    Property Value
    Type Description
    System.Int32
    Overrides
    SfScrollControl.VerticalScrollIncrement

    Methods

    CreateAccessibilityInstance()

    Overridden to update the custom accessibility object for the SfDataGrid.

    Declaration
    protected override AccessibleObject CreateAccessibilityInstance()
    Returns
    Type Description
    System.Windows.Forms.AccessibleObject

    Returns the accessibility object of the SfDataGrid.

    Overrides
    SfScrollControl.CreateAccessibilityInstance()

    CreateScrollAxis(Orientation, Boolean, IScrollBar, ILineSizeHost)

    Creates the collection of lines to hold the visible columns and the visible rows.

    Declaration
    protected virtual ScrollAxisBase CreateScrollAxis(Orientation orientation, bool pixelScroll, IScrollBar scrollBar, ILineSizeHost lineSizes)
    Parameters
    Type Name Description
    System.Windows.Forms.Orientation orientation

    The System.Windows.Forms.Orientation of the axis.

    System.Boolean pixelScroll

    Indicates whether to create the collection for pixel scrolling or line scrolling.

    IScrollBar scrollBar

    The scrollbar.

    ILineSizeHost lineSizes

    The collection of line sizes.

    Returns
    Type Description
    ScrollAxisBase

    Returns the collection of visible columns or rows.

    Dispose(Boolean)

    Disposes of the resource used by the TableControl.

    Declaration
    protected override void Dispose(bool disposing)
    Parameters
    Type Name Description
    System.Boolean disposing

    Indicates the call is from Dispose method.

    Overrides
    SfScrollControl.Dispose(Boolean)

    GetCellRectangle(VisibleLineInfo, VisibleLineInfo, Boolean, Boolean)

    Returns the rectangle that represents the display area for a cell,as determined by row line and column line.

    Declaration
    public static Rectangle GetCellRectangle(VisibleLineInfo rowInfo, VisibleLineInfo colinfo, bool isClipped, bool isRightToLeft)
    Parameters
    Type Name Description
    VisibleLineInfo rowInfo

    row line of an cell.

    VisibleLineInfo colinfo

    column of an cell.

    System.Boolean isClipped

    True to get the clipped Rectangle;false to get the Rectangle value .

    System.Boolean isRightToLeft

    To to get the rectangle in right to left mode, false to get clipped

    Returns
    Type Description
    System.Drawing.Rectangle

    The Rectangle represents the area of the desired cell.

    GetCellRectangle(Int32, Int32, Boolean)

    Returns the rectangle that represents the display area for a cell,as determined by row index and column index. returns Empty when the cell is not in visible range.

    Declaration
    public Rectangle GetCellRectangle(int rowIndex, int colIndex, bool isClipped)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The row index for the desired cell.

    System.Int32 colIndex

    column index for the desired cell.

    System.Boolean isClipped

    True to get clipped Rectangle ;false to get Rectangle value.

    Returns
    Type Description
    System.Drawing.Rectangle

    The Rectangle represents the area of the desired cell.

    GetColumnRectangle(VisibleLineInfo, Boolean)

    Returns the rectangle that represents the display area of the column, as determined by column line.

    Declaration
    public Rectangle GetColumnRectangle(VisibleLineInfo colInfo, bool isClipped)
    Parameters
    Type Name Description
    VisibleLineInfo colInfo

    The line info of the column.

    System.Boolean isClipped

    Value indicating that the column is clipped or not.

    Returns
    Type Description
    System.Drawing.Rectangle

    The rectangle that represents the display area of the column, as determined by column line.

    GetColumnRectangle(Int32, Boolean)

    Returns the rectangle that represents the display area of the column, as determined by column index.

    Declaration
    public Rectangle GetColumnRectangle(int columnIndex, bool isclipped)
    Parameters
    Type Name Description
    System.Int32 columnIndex

    The index of column.

    System.Boolean isclipped

    Value indicating that the column is clipped or not.

    Returns
    Type Description
    System.Drawing.Rectangle

    the rectangle that represents the display area of the column, as determined by column index.

    GetRowRectangle(VisibleLineInfo, Boolean)

    Returns the rectangle that represents the display area for a row, as determined by the row line.

    Declaration
    public Rectangle GetRowRectangle(VisibleLineInfo rowInfo, bool isClipped)
    Parameters
    Type Name Description
    VisibleLineInfo rowInfo

    The rowInfo line for the desired row.

    System.Boolean isClipped

    True to get the Clipped Rectangle value;False to get the Rectangle value.

    Returns
    Type Description
    System.Drawing.Rectangle

    The Rectangle that represents the area of the desired row

    GetRowRectangle(Int32, Boolean)

    Returns the rectangle that represents the display area for a cell,as determined by rowIndex.

    Declaration
    public Rectangle GetRowRectangle(int rowIndex, bool isclipped)
    Parameters
    Type Name Description
    System.Int32 rowIndex

    The row index for the desired row.

    System.Boolean isclipped

    True to get Clipped Rectangle ;false to get Rectangle value.

    Returns
    Type Description
    System.Drawing.Rectangle

    The Rectangle that represents the area of the desired row

    InsertColumns(Int32, Int32)

    Adding the columns to the given column index.

    Declaration
    public void InsertColumns(int insertAtColumnIndex, int count)
    Parameters
    Type Name Description
    System.Int32 insertAtColumnIndex

    The index which needs to be insert the column.

    System.Int32 count

    The no of columns needs to be inserted.

    InsertRows(Int32, Int32)

    Inserts the new rows at the given index.

    Declaration
    public void InsertRows(int insertAtRowIndex, int count)
    Parameters
    Type Name Description
    System.Int32 insertAtRowIndex

    The index at which the new row needs to be added.

    System.Int32 count

    The no of rows needs to be added.

    IsInputKey(Keys)

    Determines whether the specified key is a regular input key or a special key that requires preprocessing.

    Declaration
    protected override bool IsInputKey(Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys keyData

    One of the System.Windows.Forms.Keys values.

    Returns
    Type Description
    System.Boolean

    true if the specified key is a regular input key; otherwise, false.

    OnCreateColumnWidths()

    Creates the collection for storing the column widths.

    Declaration
    protected virtual IPaddedEditableLineSizeHost OnCreateColumnWidths()
    Returns
    Type Description
    IPaddedEditableLineSizeHost

    Returns the columns width collection.

    OnCreateRowHeights()

    Creates the collection for storing the row heights.

    Declaration
    protected virtual IPaddedEditableLineSizeHost OnCreateRowHeights()
    Returns
    Type Description
    IPaddedEditableLineSizeHost

    Returns the line size collection.

    OnHorizontalScroll(ScrollEventArgs)

    Overridden calculates the offset for horizontal scrolling.

    Declaration
    protected override void OnHorizontalScroll(ScrollEventArgs se)
    Parameters
    Type Name Description
    System.Windows.Forms.ScrollEventArgs se

    The System.Windows.Forms.ScrollEventArgs that contains the event data.

    Overrides
    SfScrollControl.OnHorizontalScroll(ScrollEventArgs)

    OnHorizontalScrollBarValueChanged()

    Overridden to perform the scrolling on the TableControl while changing the horizontal scrollbar value.

    Declaration
    protected override void OnHorizontalScrollBarValueChanged()
    Overrides
    SfScrollControl.OnHorizontalScrollBarValueChanged()

    OnKeyDown(KeyEventArgs)

    Occurs when the KeyDown event of TableControl is raised.

    Declaration
    protected override void OnKeyDown(KeyEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs e

    The System.Windows.Forms.KeyEventArgs that contains the event data.

    OnKeyPress(KeyPressEventArgs)

    Occurs when the KeyPress event of TableControl is raised.

    Declaration
    protected override void OnKeyPress(KeyPressEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyPressEventArgs e

    The System.Windows.Forms.KeyPressEventArgs that contains the event data.

    OnKeyUp(KeyEventArgs)

    Occurs when the KeyUp event of TableControl is raised.

    Declaration
    protected override void OnKeyUp(KeyEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.KeyEventArgs e

    The System.Windows.Forms.KeyEventArgs that contains the event data.

    OnLayout(LayoutEventArgs)

    Overridden to update the scrollbars and the view of control.

    Declaration
    protected override void OnLayout(LayoutEventArgs levent)
    Parameters
    Type Name Description
    System.Windows.Forms.LayoutEventArgs levent

    The System.Windows.Forms.LayoutEventArgs that contains the event data.

    OnMouseWheel(MouseEventArgs)

    Overridden to cancel the mouse wheel operation for the DateTime column.

    Declaration
    protected override void OnMouseWheel(MouseEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.MouseEventArgs e

    An System.Windows.Forms.MouseEventArgs that contains event data.

    Overrides
    SfScrollControl.OnMouseWheel(MouseEventArgs)

    OnPaint(PaintEventArgs)

    Overridden to call the Syncfusion.WinForms.DataGrid.GridPainter.OnPaint(System.Windows.Forms.PaintEventArgs,System.Drawing.Size) method to draw the table control.

    Declaration
    protected override void OnPaint(PaintEventArgs e)
    Parameters
    Type Name Description
    System.Windows.Forms.PaintEventArgs e

    Provides paint data to the control.

    OnSetCursor(ref Message)

    Sets the current mouse cursor.

    Declaration
    protected override void OnSetCursor(ref Message m)
    Parameters
    Type Name Description
    System.Windows.Forms.Message m

    The Window message.

    Overrides
    SfScrollControl.OnSetCursor(ref Message)

    OnSizeChanged(EventArgs)

    Overridden to update the scroll bars when the size of the control is changed.

    Declaration
    protected override void OnSizeChanged(EventArgs e)
    Parameters
    Type Name Description
    System.EventArgs e

    The System.EventArgs that contains event data.

    Overrides
    SfScrollControl.OnSizeChanged(EventArgs)

    OnTouchPan(Point, Boolean)

    Overridden to update the old scroll values on panning.

    Declaration
    protected override bool OnTouchPan(Point currentTouchPoint, bool isSwipeScroll)
    Parameters
    Type Name Description
    System.Drawing.Point currentTouchPoint

    The current touch position.

    System.Boolean isSwipeScroll

    Indicates whether to perform swipe or pan operation.

    Returns
    Type Description
    System.Boolean

    Returns false when the panning is started over the frozen rows, otherwise returns true.

    Overrides
    SfScrollControl.OnTouchPan(Point, Boolean)

    OnTouchPanBegin(Point)

    Overridden to check whether the touch start position begins with the Frozen rows or not.

    Declaration
    protected override bool OnTouchPanBegin(Point touchBeginPoint)
    Parameters
    Type Name Description
    System.Drawing.Point touchBeginPoint

    The touch position when panning operation is start.

    Returns
    Type Description
    System.Boolean

    Return false when the start positions is contains the frozen rows, otherwise return true.

    Overrides
    SfScrollControl.OnTouchPanBegin(Point)

    OnTouchPanEnd(Point)

    Overridden to raise the MouseUp event when the dragging is performed on the frozen rows.

    Declaration
    protected override bool OnTouchPanEnd(Point touchEndPoint)
    Parameters
    Type Name Description
    System.Drawing.Point touchEndPoint

    The touch position when panning operation is start.

    Returns
    Type Description
    System.Boolean

    Return false when the start positions is contains the frozen rows, otherwise return true.

    Overrides
    SfScrollControl.OnTouchPanEnd(Point)

    OnVerticalScroll(ScrollEventArgs)

    Overridden to calculates the offset for vertical scrolling.

    Declaration
    protected override void OnVerticalScroll(ScrollEventArgs se)
    Parameters
    Type Name Description
    System.Windows.Forms.ScrollEventArgs se

    The System.Windows.Forms.ScrollEventArgs that contains the event data.

    Overrides
    SfScrollControl.OnVerticalScroll(ScrollEventArgs)

    OnVerticalScrollBarValueChanged()

    Overridden to perform the scrolling on the TableControl while changing the vertical scrollbar value.

    Declaration
    protected override void OnVerticalScrollBarValueChanged()
    Overrides
    SfScrollControl.OnVerticalScrollBarValueChanged()

    PointToCellRowColumnIndex(Point, Boolean)

    Gets the row and column index of the cell based on the given point.

    Declaration
    public RowColumnIndex PointToCellRowColumnIndex(Point p, bool allowOutSideLines = false)
    Parameters
    Type Name Description
    System.Drawing.Point p

    The point that needs to get the row and column index.

    System.Boolean allowOutSideLines

    Specifies whether to get the row, column index for the mouse position out of the view.

    Returns
    Type Description
    RowColumnIndex

    Returns the row and column index of cell at the given point.

    ProcessDialogKey(Keys)

    Overridden to process the dialog key.

    Declaration
    protected override bool ProcessDialogKey(Keys keyData)
    Parameters
    Type Name Description
    System.Windows.Forms.Keys keyData

    The System.Windows.Keys.

    Returns
    Type Description
    System.Boolean

    Returns true if the dialog key is handled; otherwise returns false.

    RefreshContainerAndView()

    Updates the row generator collection of the data view.

    Declaration
    protected virtual void RefreshContainerAndView()

    RefreshHeaderLineCount()

    Resets the line header lines count.

    Declaration
    protected virtual void RefreshHeaderLineCount()

    RemoveColumns(Int32, Int32)

    Removes the columns at the given index.

    Declaration
    public void RemoveColumns(int removeAtColumnIndex, int count)
    Parameters
    Type Name Description
    System.Int32 removeAtColumnIndex

    The remove At Column Index.

    System.Int32 count

    The no of columns needs to be removed.

    RemoveRows(Int32, Int32)

    Removes the lines at the given row index.

    Declaration
    public void RemoveRows(int removeAtRowIndex, int count)
    Parameters
    Type Name Description
    System.Int32 removeAtRowIndex

    The row index that needs to be removed.

    System.Int32 count

    The no of rows needs to be removed from the row index.

    ScrollWindow(Int32, Int32, Rectangle, Rectangle, Boolean)

    Overridden to perform the scrolling on the TableControl.

    Declaration
    public override Rectangle ScrollWindow(int xAmount, int yAmount, Rectangle rect, Rectangle clipRect, bool allowUpdate)
    Parameters
    Type Name Description
    System.Int32 xAmount

    The x amount that need to be scrolled.

    System.Int32 yAmount

    The y amount that need to be scrolled on vertical direction.

    System.Drawing.Rectangle rect

    The bounds that need to be scrolled.

    System.Drawing.Rectangle clipRect

    The ClipRectangle.

    System.Boolean allowUpdate

    Specifies the value for update the window after the scrolling or not.

    Returns
    Type Description
    System.Drawing.Rectangle

    Returns the rectangle region that is scrolled.

    Overrides
    SfScrollControl.ScrollWindow(Int32, Int32, Rectangle, Rectangle, Boolean)

    SetHorizontalOffset(Double)

    Sets the value for horizontal scroll info.

    Declaration
    public void SetHorizontalOffset(double offset)
    Parameters
    Type Name Description
    System.Double offset

    The value that needs to be set for the scrollbar.

    SetRowGenerator()

    Initialize a new instance of Syncfusion.WinForms.DataGrid.TableControl.RowGenerator.

    Declaration
    protected virtual void SetRowGenerator()

    SetVerticalOffset(Double)

    Sets the value of the vertical scrollbar.

    Declaration
    public void SetVerticalOffset(double offset)
    Parameters
    Type Name Description
    System.Double offset

    The value that needs to be set for the scrollbar.

    UpdateAxis(Size)

    Updates the size of the ViewPort, visible rows and visible columns.

    Declaration
    public void UpdateAxis(Size availableSize)
    Parameters
    Type Name Description
    System.Drawing.Size availableSize

    The size that needs to be updated for the view port.

    UpdateScrollBars()

    Updates the Scrollbar when perform row or column manipulation(Insert, delete, hide, adjust size, etc.).

    Declaration
    public override void UpdateScrollBars()
    Overrides
    SfScrollControl.UpdateScrollBars()

    Implements

    IThemeProvider
    IVisualStyle
    System.IDisposable
    ISupportUpdate

    Extension Methods

    DataGridIndexResolver.GetHeaderIndex(TableControl)
    DataGridIndexResolver.GetTableSummaryCount(TableControl, VerticalPosition)
    DataGridIndexResolver.IsTableSummaryIndex(TableControl, Int32)
    DataGridIndexResolver.ResolveStartIndexBasedOnPosition(TableControl)
    DataGridIndexResolver.ResolveStartIndexOfGroup(TableControl, Group)
    DataGridIndexResolver.ResolveToGridVisibleColumnIndex(TableControl, Int32)
    DataGridIndexResolver.ResolveToRecordIndex(TableControl, Int32)
    DataGridIndexResolver.ResolveToRowIndex(TableControl, Int32)
    DataGridIndexResolver.ResolveToRowIndex(TableControl, Object)
    DataGridIndexResolver.ResolveToRowIndex(TableControl, NodeEntry)
    DataGridIndexResolver.ResolveToScrollColumnIndex(TableControl, Int32)
    DataGridIndexResolver.ResolveToStartColumnIndex(TableControl)
    Back to top Generated by DocFX
    Copyright © 2001 - 2021 Syncfusion Inc. All Rights Reserved