DataGridViewRow.AdjustRowHeaderBorderStyle 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
根據指定的準則,修改輸入資料列行首框線樣式。
public:
virtual System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ AdjustRowHeaderBorderStyle(System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStyleInput, System::Windows::Forms::DataGridViewAdvancedBorderStyle ^ dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow);
public virtual System.Windows.Forms.DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle (System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, System.Windows.Forms.DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedRow, bool isLastVisibleRow);
abstract member AdjustRowHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
override this.AdjustRowHeaderBorderStyle : System.Windows.Forms.DataGridViewAdvancedBorderStyle * System.Windows.Forms.DataGridViewAdvancedBorderStyle * bool * bool * bool * bool -> System.Windows.Forms.DataGridViewAdvancedBorderStyle
Public Overridable Function AdjustRowHeaderBorderStyle (dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, dataGridViewAdvancedBorderStylePlaceholder As DataGridViewAdvancedBorderStyle, singleVerticalBorderAdded As Boolean, singleHorizontalBorderAdded As Boolean, isFirstDisplayedRow As Boolean, isLastVisibleRow As Boolean) As DataGridViewAdvancedBorderStyle
參數
- dataGridViewAdvancedBorderStyleInput
- DataGridViewAdvancedBorderStyle
DataGridViewAdvancedBorderStyle,表示要修改的資料列行首框線樣式。
- dataGridViewAdvancedBorderStylePlaceholder
- DataGridViewAdvancedBorderStyle
DataGridViewAdvancedBorderStyle,用來儲存對資料列行首框線樣式所做的中繼變更。
- singleVerticalBorderAdded
- Boolean
true
表示要在所產生的結果上加入單垂直框線,否則為 false
。
- singleHorizontalBorderAdded
- Boolean
true
表示要在所產生的結果上加入單水平框線,否則為 false
。
- isFirstDisplayedRow
- Boolean
如果資料列是 DataGridView 中所顯示的第一個資料列,則為 true
,否則為 false
。
- isLastVisibleRow
- Boolean
如果目前的資料列是將 DataGridView 屬性設定為 true
之 Visible 中的最後一個資料列,則為 true
,否則為 false
。
傳回
DataGridViewAdvancedBorderStyle,表示所使用的新框線樣式。
範例
下列程式碼範例示範如何覆寫 AdjustRowHeaderBorderStyle 方法來自訂資料列標題儲存格的框線。 此程式碼範例是提供給 類別之較大範例的 DataGridViewAdvancedBorderStyle 一部分。
public override DataGridViewAdvancedBorderStyle AdjustRowHeaderBorderStyle(
DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput,
DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceHolder,
bool singleVerticalBorderAdded,
bool singleHorizontalBorderAdded,
bool isFirstDisplayedRow,
bool isLastDisplayedRow)
{
// Customize the top border of the first row header and the
// right border of all the row headers. Use the input style for
// all other borders.
dataGridViewAdvancedBorderStylePlaceHolder.Top = isFirstDisplayedRow ?
DataGridViewAdvancedCellBorderStyle.InsetDouble :
DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceHolder.Right =
DataGridViewAdvancedCellBorderStyle.OutsetDouble;
dataGridViewAdvancedBorderStylePlaceHolder.Left =
dataGridViewAdvancedBorderStyleInput.Left;
dataGridViewAdvancedBorderStylePlaceHolder.Bottom =
dataGridViewAdvancedBorderStyleInput.Bottom;
return dataGridViewAdvancedBorderStylePlaceHolder;
}
Public Overrides Function AdjustRowHeaderBorderStyle( _
ByVal dataGridViewAdvancedBorderStyleInput As DataGridViewAdvancedBorderStyle, _
ByVal dataGridViewAdvancedBorderStylePlaceHolder As DataGridViewAdvancedBorderStyle, _
ByVal singleVerticalBorderAdded As Boolean, _
ByVal singleHorizontalBorderAdded As Boolean, _
ByVal isFirstDisplayedRow As Boolean, _
ByVal isLastDisplayedRow As Boolean) As DataGridViewAdvancedBorderStyle
' Customize the top border of the first row header and the
' right border of all the row headers. Use the input style for
' all other borders.
If isFirstDisplayedRow Then
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.InsetDouble
Else
dataGridViewAdvancedBorderStylePlaceHolder.Top = _
DataGridViewAdvancedCellBorderStyle.None
End If
With dataGridViewAdvancedBorderStylePlaceHolder
.Right = DataGridViewAdvancedCellBorderStyle.OutsetDouble
.Left = dataGridViewAdvancedBorderStyleInput.Left
.Bottom = dataGridViewAdvancedBorderStyleInput.Bottom
End With
Return dataGridViewAdvancedBorderStylePlaceHolder
End Function
End Class
備註
控制項 DataGridView 會在內部呼叫 AdjustRowHeaderBorderStyle 方法,以判斷資料列標題儲存格的框線外觀。 控制項 DataGridView 通常會使用 dataGridViewAdvancedBorderStyleInput
參數的 AdvancedRowHeadersBorderStyle 屬性值。
給繼承者的注意事項
如果您想要自訂資料列標題儲存格框線的外觀,請覆寫這個方法。