DataGridViewCell.AdjustCellBorderStyle Metoda

Definice

Upraví styl ohraničení vstupní buňky podle zadaných kritérií.

public:
 virtual System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ AdjustCellBorderStyle(System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStyleInput, System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow);
public virtual System.Windows.Forms.DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow);
abstract member AdjustCellBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
override this.AdjustCellBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
Public Overridable Function AdjustCellBorderStyle (dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, dataGridViewAdvancedBorderStylePlaceholder As DataGridViewAdvancedBorderStyle, singleVerticalBorderAdded As Boolean, singleHorizontalBorderAdded As Boolean, isFirstDisplayedColumn As Boolean, isFirstDisplayedRow As Boolean) As DataGridViewAdvancedBorderStyle

Parametry

dataGridViewAdvancedBorderStyleInput
DataGridViewAdvancedBorderStyle

A DataGridViewAdvancedBorderStyle , který představuje styl ohraničení buňky, který chcete upravit.

dataGridViewAdvancedBorderStylePlaceholder
DataGridViewAdvancedBorderStyle

Slouží DataGridViewAdvancedBorderStyle k ukládání přechodných změn stylu ohraničení buňky.

singleVerticalBorderAdded
Boolean

true přidat svislé ohraničení do buňky; falsev opačném případě .

singleHorizontalBorderAdded
Boolean

true přidat vodorovné ohraničení do buňky; falsev opačném případě .

isFirstDisplayedColumn
Boolean

true pokud je hostující buňka v prvním viditelném sloupci; falsev opačném případě .

isFirstDisplayedRow
Boolean

true pokud je hostující buňka v prvním viditelném řádku; falsev opačném případě .

Návraty

DataGridViewAdvancedBorderStyle

Změněno DataGridViewAdvancedBorderStyle.

Příklady

Následující příklad kódu ukazuje, jak přepsat metodu AdjustCellBorderStyle přizpůsobení ohraničení buněk. Tento příklad kódu je součástí většího příkladu poskytnutého DataGridViewAdvancedBorderStyle pro třídu.

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;
}
    Public Overrides Function AdjustCellBorderStyle( _
        ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
        ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
        ByVal singleVerticalBorderAdded As Boolean, _
        ByVal singleHorizontalBorderAdded As Boolean, _
        ByVal firstVisibleColumn As Boolean, _
        ByVal firstVisibleRow As Boolean) As DataGridViewAdvancedBorderStyle

        ' 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.
        If firstVisibleColumn Then
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.OutsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Left = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        If firstVisibleRow Then
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.InsetDouble
        Else
            dataGridViewAdvancedBorderStylePlaceHolder.Top = _
                DataGridViewAdvancedCellBorderStyle.None
        End If

        With dataGridViewAdvancedBorderStylePlaceHolder
            .Right = dataGridViewAdvancedBorderStyleInput.Right
            .Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
        End With

        Return dataGridViewAdvancedBorderStylePlaceHolder
    End Function
End Class

Poznámky

Ovládací DataGridView prvek interně volá metodu AdjustCellBorderStyle k určení vzhledu ohraničení buňky. Ovládací DataGridView prvek obvykle používá hodnotu AdvancedCellBorderStyle vlastnosti parametru dataGridViewAdvancedBorderStyleInput .

Hodnota DataGridViewAdvancedCellBorderStyle.OutsetPartial není podporována jako styl zadávání pro buňky.

Poznámky pro dědice

Tuto metodu přepište, pokud chcete přizpůsobit vzhled ohraničení buňky.

Platí pro

Viz také