Export (0) Print
Expand All
Expand Minimize

DataGridViewCell.AdjustCellBorderStyle Method

Note: This method is new in the .NET Framework version 2.0.

Modifies the input cell border style according to the specified criteria.

Namespace: System.Windows.Forms
Assembly: System.Windows.Forms (in system.windows.forms.dll)

public virtual DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder,
	bool singleVerticalBorderAdded,
	bool singleHorizontalBorderAdded,
	bool isFirstDisplayedColumn,
	bool isFirstDisplayedRow
)
public DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, 
	DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, 
	boolean singleVerticalBorderAdded, 
	boolean singleHorizontalBorderAdded, 
	boolean isFirstDisplayedColumn, 
	boolean isFirstDisplayedRow
)
public function AdjustCellBorderStyle (
	dataGridViewAdvancedBorderStyleInput : DataGridViewAdvancedBorderStyle, 
	dataGridViewAdvancedBorderStylePlaceholder : DataGridViewAdvancedBorderStyle, 
	singleVerticalBorderAdded : boolean, 
	singleHorizontalBorderAdded : boolean, 
	isFirstDisplayedColumn : boolean, 
	isFirstDisplayedRow : boolean
) : DataGridViewAdvancedBorderStyle

Parameters

dataGridViewAdvancedBorderStyleInput

A DataGridViewAdvancedBorderStyle that represents the cell border style to modify.

dataGridViewAdvancedBorderStylePlaceholder

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

singleVerticalBorderAdded

true to add a vertical border to the cell; otherwise, false.

singleHorizontalBorderAdded

true to add a horizontal border to the cell; otherwise, false.

isFirstDisplayedColumn

true if the hosting cell is in the first visible column; otherwise, false.

isFirstDisplayedRow

true if the hosting cell is in the first visible row; otherwise, false.

Return Value

The modified DataGridViewAdvancedBorderStyle.

The DataGridView control internally calls the AdjustCellBorderStyle method to determine the appearance of the cell borders. The DataGridView control typically uses the value of the AdvancedCellBorderStyle property for the dataGridViewAdvancedBorderStyleInput parameter.

The DataGridViewAdvancedCellBorderStyle.OutsetPartial value is not supported as an input style for cells.

Notes to Inheritors Override this method if you want to customize the appearance of the cell borders.

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

public override DataGridViewAdvancedBorderStyle AdjustCellBorderStyle(
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
    DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
    bool singleVerticalBorderAdded,
    bool singleHorizontalBorderAdded,
    bool firstVisibleColumn,
    bool firstVisibleRow)
{
    // Customize the top border of cells in the first row and the 
    // right border of cells in the first column. Use the input style 
    // for all other borders.
    dataGridViewAdvancedBorderStylePlaceHolder.Left = firstVisibleColumn ?
        DataGridViewAdvancedCellBorderStyle.OutsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;
    dataGridViewAdvancedBorderStylePlaceHolder.Top = firstVisibleRow ?
        DataGridViewAdvancedCellBorderStyle.InsetDouble :
        DataGridViewAdvancedCellBorderStyle.None;

    dataGridViewAdvancedBorderStylePlaceHolder.Right =
        dataGridViewAdvancedBorderStyleInput.Right;
    dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
        dataGridViewAdvancedBorderStyleInput.Bottom;

    return dataGridViewAdvancedBorderStylePlaceHolder;
}

Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile for Pocket PC, Windows Mobile for Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

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

.NET Framework

Supported in: 2.0

Community Additions

ADD
Show:
© 2014 Microsoft