Export (0) Print
Expand All

DataGridViewLinkCell Class

Represents a cell that contains a link.

Namespace:  System.Windows.Forms
Assembly:  System.Windows.Forms (in System.Windows.Forms.dll)

'Declaration
Public Class DataGridViewLinkCell _
	Inherits DataGridViewCell

The DataGridViewLinkCell type exposes the following members.

  NameDescription
Public methodDataGridViewLinkCellInitializes a new instance of the DataGridViewLinkCell class.
Top

  NameDescription
Public propertyAccessibilityObjectGets the DataGridViewCell.DataGridViewCellAccessibleObject assigned to the DataGridViewCell. (Inherited from DataGridViewCell.)
Public propertyActiveLinkColorGets or sets the color used to display an active link.
Public propertyColumnIndexGets the column index for this cell. (Inherited from DataGridViewCell.)
Public propertyContentBoundsGets the bounding rectangle that encloses the cell's content area. (Inherited from DataGridViewCell.)
Public propertyContextMenuStripGets or sets the shortcut menu associated with the cell. (Inherited from DataGridViewCell.)
Public propertyDataGridViewGets the DataGridView control associated with this element. (Inherited from DataGridViewElement.)
Public propertyDefaultNewRowValueGets the default value for a cell in the row for new records. (Inherited from DataGridViewCell.)
Public propertyDisplayedGets a value that indicates whether the cell is currently displayed on-screen. (Inherited from DataGridViewCell.)
Public propertyEditedFormattedValueGets the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed. (Inherited from DataGridViewCell.)
Public propertyEditTypeGets the type of the cell's hosted editing control. (Overrides DataGridViewCell.EditType.)
Public propertyErrorIconBoundsGets the bounds of the error icon for the cell. (Inherited from DataGridViewCell.)
Public propertyErrorTextGets or sets the text describing an error condition associated with the cell. (Inherited from DataGridViewCell.)
Public propertyFormattedValueGets the value of the cell as formatted for display. (Inherited from DataGridViewCell.)
Public propertyFormattedValueTypeGets the display Type of the cell value. (Overrides DataGridViewCell.FormattedValueType.)
Public propertyFrozenGets a value indicating whether the cell is frozen. (Inherited from DataGridViewCell.)
Public propertyHasStyleGets a value indicating whether the Style property has been set. (Inherited from DataGridViewCell.)
Public propertyInheritedStateGets the current state of the cell as inherited from the state of its row and column. (Inherited from DataGridViewCell.)
Public propertyInheritedStyleGets the style currently applied to the cell. (Inherited from DataGridViewCell.)
Public propertyIsInEditModeGets a value indicating whether this cell is currently being edited. (Inherited from DataGridViewCell.)
Public propertyLinkBehaviorGets or sets a value that represents the behavior of a link.
Public propertyLinkColorGets or sets the color used to display an inactive and unvisited link.
Public propertyLinkVisitedGets or sets a value indicating whether the link was visited.
Public propertyOwningColumnGets the column that contains this cell. (Inherited from DataGridViewCell.)
Public propertyOwningRowGets the row that contains this cell. (Inherited from DataGridViewCell.)
Public propertyPreferredSizeGets the size, in pixels, of a rectangular area into which the cell can fit. (Inherited from DataGridViewCell.)
Public propertyReadOnlyGets or sets a value indicating whether the cell's data can be edited. (Inherited from DataGridViewCell.)
Public propertyResizableGets a value indicating whether the cell can be resized. (Inherited from DataGridViewCell.)
Public propertyRowIndexGets the index of the cell's parent row. (Inherited from DataGridViewCell.)
Public propertySelectedGets or sets a value indicating whether the cell has been selected. (Inherited from DataGridViewCell.)
Public propertySizeGets the size of the cell. (Inherited from DataGridViewCell.)
Public propertyStateGets the user interface (UI) state of the element. (Inherited from DataGridViewElement.)
Public propertyStyleGets or sets the style for the cell. (Inherited from DataGridViewCell.)
Public propertyTagGets or sets the object that contains supplemental data about the cell. (Inherited from DataGridViewCell.)
Public propertyToolTipTextGets or sets the ToolTip text associated with this cell. (Inherited from DataGridViewCell.)
Public propertyTrackVisitedStateGets or sets a value indicating whether the link changes color when it is visited.
Public propertyUseColumnTextForLinkValueGets or sets a value indicating whether the column Text property value is displayed as the link text.
Public propertyValueGets or sets the value associated with this cell. (Inherited from DataGridViewCell.)
Public propertyValueTypeGets or sets the data type of the values in the cell. (Overrides DataGridViewCell.ValueType.)
Public propertyVisibleGets a value indicating whether the cell is in a row or column that has been hidden. (Inherited from DataGridViewCell.)
Public propertyVisitedLinkColorGets or sets the color used to display a link that has been previously visited.
Top

  NameDescription
Public methodAdjustCellBorderStyleModifies the input cell border style according to the specified criteria. (Inherited from DataGridViewCell.)
Protected methodBorderWidthsReturns a Rectangle that represents the widths of all the cell margins. (Inherited from DataGridViewCell.)
Protected methodClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is clicked. (Inherited from DataGridViewCell.)
Public methodCloneCreates an exact copy of this cell. (Overrides DataGridViewCell.Clone.)
Protected methodContentClickUnsharesRowIndicates whether the cell's row will be unshared when the cell's content is clicked. (Inherited from DataGridViewCell.)
Protected methodContentDoubleClickUnsharesRowIndicates whether the cell's row will be unshared when the cell's content is double-clicked. (Inherited from DataGridViewCell.)
Protected methodCreateAccessibilityInstanceCreates a new accessible object for the DataGridViewLinkCell. (Overrides DataGridViewCell.CreateAccessibilityInstance.)
Public methodDetachEditingControlRemoves the cell's editing control from the DataGridView. (Inherited from DataGridViewCell.)
Public methodDisposeReleases all resources used by the DataGridViewCell. (Inherited from DataGridViewCell.)
Protected methodDispose(Boolean)Releases the unmanaged resources used by the DataGridViewCell and optionally releases the managed resources. (Inherited from DataGridViewCell.)
Protected methodDoubleClickUnsharesRowIndicates whether the cell's row will be unshared when the cell is double-clicked. (Inherited from DataGridViewCell.)
Protected methodEnterUnsharesRowIndicates whether the parent row will be unshared when the focus moves to the cell. (Inherited from DataGridViewCell.)
Public methodEquals(Object)Determines whether the specified object is equal to the current object. (Inherited from Object.)
Protected methodFinalizeReleases the unmanaged resources and performs other cleanup operations before the DataGridViewCell is reclaimed by garbage collection. (Inherited from DataGridViewCell.)
Protected methodGetClipboardContentRetrieves the formatted value of the cell to copy to the Clipboard. (Inherited from DataGridViewCell.)
Public methodGetContentBounds(Int32)Returns the bounding rectangle that encloses the cell's content area using a default Graphics and cell style currently in effect for the cell. (Inherited from DataGridViewCell.)
Protected methodGetContentBounds(Graphics, DataGridViewCellStyle, Int32)Returns the bounding rectangle that encloses the cell's content area, which is calculated using the specified Graphics and cell style. (Overrides DataGridViewCell.GetContentBounds(Graphics, DataGridViewCellStyle, Int32).)
Public methodGetEditedFormattedValueReturns the current, formatted value of the cell, regardless of whether the cell is in edit mode and the value has not been committed. (Inherited from DataGridViewCell.)
Protected methodGetErrorIconBoundsReturns the bounding rectangle that encloses the cell's error icon, if one is displayed. (Overrides DataGridViewCell.GetErrorIconBounds(Graphics, DataGridViewCellStyle, Int32).)
Protected methodGetErrorTextReturns a string that represents the error for the cell. (Inherited from DataGridViewCell.)
Protected methodGetFormattedValueGets the value of the cell as formatted for display. (Inherited from DataGridViewCell.)
Public methodGetHashCodeServes as the default hash function. (Inherited from Object.)
Public methodGetInheritedContextMenuStripGets the inherited shortcut menu for the current cell. (Inherited from DataGridViewCell.)
Public methodGetInheritedStateReturns a value indicating the current state of the cell as inherited from the state of its row and column. (Inherited from DataGridViewCell.)
Public methodGetInheritedStyleGets the style applied to the cell. (Inherited from DataGridViewCell.)
Protected methodGetPreferredSizeCalculates the preferred size, in pixels, of the cell. (Overrides DataGridViewCell.GetPreferredSize(Graphics, DataGridViewCellStyle, Int32, Size).)
Protected methodGetSizeGets the size of the cell. (Inherited from DataGridViewCell.)
Public methodGetTypeGets the Type of the current instance. (Inherited from Object.)
Protected methodGetValueGets the value of the cell. (Overrides DataGridViewCell.GetValue(Int32).)
Public methodInitializeEditingControlInitializes the control used to edit the cell. (Inherited from DataGridViewCell.)
Protected methodKeyDownUnsharesRowIndicates whether the parent row is unshared if the user presses a key while the focus is on the cell. (Inherited from DataGridViewCell.)
Public methodKeyEntersEditModeDetermines if edit mode should be started based on the given key. (Inherited from DataGridViewCell.)
Protected methodKeyPressUnsharesRowIndicates whether a row will be unshared if a key is pressed while a cell in the row has focus. (Inherited from DataGridViewCell.)
Protected methodKeyUpUnsharesRowIndicates whether the row containing the cell will be unshared when a key is released and the cell has focus. (Overrides DataGridViewCell.KeyUpUnsharesRow(KeyEventArgs, Int32).)
Protected methodLeaveUnsharesRowIndicates whether a row will be unshared when the focus leaves a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMemberwiseCloneCreates a shallow copy of the current Object. (Inherited from Object.)
Protected methodMouseClickUnsharesRowIndicates whether a row will be unshared if the user clicks a mouse button while the pointer is on a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMouseDoubleClickUnsharesRowIndicates whether a row will be unshared if the user double-clicks a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMouseDownUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse button is pressed while the pointer is over the cell. (Overrides DataGridViewCell.MouseDownUnsharesRow(DataGridViewCellMouseEventArgs).)
Protected methodMouseEnterUnsharesRowIndicates whether a row will be unshared when the mouse pointer moves over a cell in the row. (Inherited from DataGridViewCell.)
Protected methodMouseLeaveUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse pointer leaves the cell. (Overrides DataGridViewCell.MouseLeaveUnsharesRow(Int32).)
Protected methodMouseMoveUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse pointer moves over the cell. (Overrides DataGridViewCell.MouseMoveUnsharesRow(DataGridViewCellMouseEventArgs).)
Protected methodMouseUpUnsharesRowIndicates whether the row containing the cell will be unshared when the mouse button is released while the pointer is over the cell. (Overrides DataGridViewCell.MouseUpUnsharesRow(DataGridViewCellMouseEventArgs).)
Protected methodOnClickCalled when the cell is clicked. (Inherited from DataGridViewCell.)
Protected methodOnContentClickCalled when the cell's contents are clicked. (Inherited from DataGridViewCell.)
Protected methodOnContentDoubleClickCalled when the cell's contents are double-clicked. (Inherited from DataGridViewCell.)
Protected methodOnDataGridViewChangedCalled when the DataGridView property of the cell changes. (Inherited from DataGridViewCell.)
Protected methodOnDoubleClickCalled when the cell is double-clicked. (Inherited from DataGridViewCell.)
Protected methodOnEnterCalled when the focus moves to a cell. (Inherited from DataGridViewCell.)
Protected methodOnKeyDownCalled when a character key is pressed while the focus is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnKeyPressCalled when a key is pressed while the focus is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnKeyUpCalled when a character key is released while the focus is on a cell. (Overrides DataGridViewCell.OnKeyUp(KeyEventArgs, Int32).)
Protected methodOnLeaveCalled when the focus moves from a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseClickCalled when the user clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseDoubleClickCalled when the user double-clicks a mouse button while the pointer is on a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseDownCalled when the user holds down a mouse button while the pointer is on a cell. (Overrides DataGridViewCell.OnMouseDown(DataGridViewCellMouseEventArgs).)
Protected methodOnMouseEnterCalled when the mouse pointer moves over a cell. (Inherited from DataGridViewCell.)
Protected methodOnMouseLeaveCalled when the mouse pointer leaves the cell. (Overrides DataGridViewCell.OnMouseLeave(Int32).)
Protected methodOnMouseMoveCalled when the mouse pointer moves within a cell. (Overrides DataGridViewCell.OnMouseMove(DataGridViewCellMouseEventArgs).)
Protected methodOnMouseUpCalled when the user releases a mouse button while the pointer is on a cell. (Overrides DataGridViewCell.OnMouseUp(DataGridViewCellMouseEventArgs).)
Protected methodPaintPaints the current DataGridViewCell. (Overrides DataGridViewCell.Paint(Graphics, Rectangle, Rectangle, Int32, DataGridViewElementStates, Object, Object, String, DataGridViewCellStyle, DataGridViewAdvancedBorderStyle, DataGridViewPaintParts).)
Protected methodPaintBorderPaints the border of the current DataGridViewCell. (Inherited from DataGridViewCell.)
Protected methodPaintErrorIconPaints the error icon of the current DataGridViewCell. (Inherited from DataGridViewCell.)
Public methodParseFormattedValueConverts a value formatted for display to an actual cell value. (Inherited from DataGridViewCell.)
Public methodPositionEditingControlSets the location and size of the editing control hosted by a cell in the DataGridView control. (Inherited from DataGridViewCell.)
Public methodPositionEditingPanelSets the location and size of the editing panel hosted by the cell, and returns the normal bounds of the editing control within the editing panel. (Inherited from DataGridViewCell.)
Protected methodRaiseCellClickRaises the DataGridView.CellClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellContentClickRaises the DataGridView.CellContentClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellContentDoubleClickRaises the DataGridView.CellContentDoubleClick event. (Inherited from DataGridViewElement.)
Protected methodRaiseCellValueChangedRaises the DataGridView.CellValueChanged event. (Inherited from DataGridViewElement.)
Protected methodRaiseDataErrorRaises the DataGridView.DataError event. (Inherited from DataGridViewElement.)
Protected methodRaiseMouseWheelRaises the Control.MouseWheel event. (Inherited from DataGridViewElement.)
Protected methodSetValueSets the value of the cell. (Inherited from DataGridViewCell.)
Public methodToStringReturns a string that describes the current object. (Overrides DataGridViewCell.ToString.)
Top

The DataGridViewLinkCell class is a specialized type of DataGridViewCell used to display links.

The DataGridViewLinkColumn is the column type specialized to hold cells of this type. By default, the DataGridViewLinkColumn.CellTemplate is initialized to a new DataGridViewLinkCell. To pattern the cells within a column after an existing DataGridViewLinkCell, set the column's CellTemplate property to the cell to use as a pattern.

The cell-related properties of the column are wrappers for the similarly-named properties of the template cell. Changing the property values of the template cell will affect only cells based on the template that are added after the change. Changing the cell-related property values of the column, however, will update the template cell and all other cells in the column, and refresh the column display if necessary.

Notes to Inheritors

When you derive from DataGridViewLinkCell and add new properties to the derived class, be sure to override the Clone method to copy the new properties during cloning operations. You should also call the base class's Clone method so that the properties of the base class are copied to the new cell.

The following code example demonstrates how to use a DataGridViewCell as a template for a DataGridViewColumn. Style changes made to any cell in the column affect all of the column's cells. This code example is part of a larger example provided for the DataGridViewColumn class.

Private Sub CustomizeCellsInThirdColumn()

    Dim thirdColumn As Integer = 2
    Dim column As DataGridViewColumn = _
        dataGridView.Columns(thirdColumn)
    Dim cell As DataGridViewCell = _
        New DataGridViewTextBoxCell()

    cell.Style.BackColor = Color.Wheat
    column.CellTemplate = cell
End Sub

.NET Framework

Supported in: 4.5.2, 4.5.1, 4.5, 4, 3.5, 3.0, 2.0

.NET Framework Client Profile

Supported in: 4, 3.5 SP1

Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
Show:
© 2014 Microsoft