DataGridViewCell::BorderWidths Method (DataGridViewAdvancedBorderStyle^)

 

Returns a Rectangle that represents the widths of all the cell margins.

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

protected:
virtual Rectangle BorderWidths(
	DataGridViewAdvancedBorderStyle^ advancedBorderStyle
)

Parameters

advancedBorderStyle
Type: System.Windows.Forms::DataGridViewAdvancedBorderStyle^

A DataGridViewAdvancedBorderStyle that the margins are to be calculated for.

Return Value

Type: System.Drawing::Rectangle

A Rectangle that represents the widths of all the cell margins.

The default width of the cell border is one pixel. Use the following DataGridViewAdvancedCellBorderStyle values to modify the width of the border:

In addition, if the DividerHeight property is set for the cell's owning row, the rectangle's height is increased by the value of DividerHeight. If the DividerWidth property is set for the cell's owning column, the rectangle's width will be increased by the value of DividerWidth.

The following code example demonstrates how to use the BorderWidths method of the DataGridViewCell class to determine the available drawing area in a cell. This code example is part of a larger example provided in How to: Disable Buttons in a Button Column in the Windows Forms DataGridView Control.

No code example is currently available or this language may not be supported.

.NET Framework
Available since 2.0
Return to top
Show: