Export (0) Print
Expand All
Expand Minimize

DataGridView.AdjustColumnHeaderBorderStyle Method

Adjusts the DataGridViewAdvancedBorderStyle for a column header cell of a DataGridView that is currently being painted.

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

public virtual DataGridViewAdvancedBorderStyle AdjustColumnHeaderBorderStyle(
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder,
	bool isFirstDisplayedColumn,
	bool isLastVisibleColumn


Type: System.Windows.Forms.DataGridViewAdvancedBorderStyle

A DataGridViewAdvancedBorderStyle that that represents the column header border style to modify.

Type: System.Windows.Forms.DataGridViewAdvancedBorderStyle

A DataGridViewAdvancedBorderStyle that is used to store intermediate changes to the column header border style.

Type: System.Boolean

true to indicate that the DataGridViewCell that is currently being painted is in the first column displayed on the DataGridView; otherwise, false.

Type: System.Boolean

true to indicate that the DataGridViewCell that is currently being painted is in the last column in the DataGridView that has the Visible property set to true; otherwise, false.

Return Value

Type: System.Windows.Forms.DataGridViewAdvancedBorderStyle
A DataGridViewAdvancedBorderStyle that represents the border style for the current column header.

The DataGridView control internally calls the AdjustColumnHeaderBorderStyle method to determine the appearance of the borders for the column header cells. The DataGridView control typically uses the value of the AdvancedColumnHeadersBorderStyle property for the dataGridViewAdvancedBorderStyleInput parameter.

Notes to Inheritors

Override this method if you want to customize the appearance of the border on column header cells.

The following code example demonstrates how to override the AdjustColumnHeaderBorderStyle method to customize the borders of the column header cells. This code example is part of a larger example provided for the DataGridViewAdvancedBorderStyle class.

public override DataGridViewAdvancedBorderStyle AdjustColumnHeaderBorderStyle(
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
    bool firstDisplayedColumn,
    bool lastVisibleColumn)
    // Customize the left border of the first column header and the 
    // bottom border of all the column headers. Use the input style for  
    // all other borders.
    dataGridViewAdvancedBorderStylePlaceHolder.Left = firstDisplayedColumn ?
        DataGridViewAdvancedCellBorderStyle.OutsetDouble :
    dataGridViewAdvancedBorderStylePlaceHolder.Bottom =

    dataGridViewAdvancedBorderStylePlaceHolder.Right =
    dataGridViewAdvancedBorderStylePlaceHolder.Top =

    return dataGridViewAdvancedBorderStylePlaceHolder;

.NET Framework

Supported in: 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.

© 2014 Microsoft