DataGridViewCellPaintingEventArgs.PaintParts 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
要繪製的儲存格部分。
public:
property System::Windows::Forms::DataGridViewPaintParts PaintParts { System::Windows::Forms::DataGridViewPaintParts get(); };
public System.Windows.Forms.DataGridViewPaintParts PaintParts { get; }
member this.PaintParts : System.Windows.Forms.DataGridViewPaintParts
Public ReadOnly Property PaintParts As DataGridViewPaintParts
屬性值
DataGridViewPaintParts 值的位元組合,指定要繪製的部分。
範例
下列程式碼範例示範如何使用這個成員。 在此範例中,事件處理常式會報告事件的發生次數 DataGridView.CellPainting 。 此報告可協助您瞭解事件發生的時間,並可協助您進行偵錯。
若要執行範例程式碼,請將它貼入包含名為 DataGridView1
之類型 DataGridView 實例的專案。 然後,確定事件處理常式與 事件相關聯 DataGridView.CellPainting 。
private void DataGridView1_CellPainting(Object sender, DataGridViewCellPaintingEventArgs e) {
System.Text.StringBuilder messageBoxCS = new System.Text.StringBuilder();
messageBoxCS.AppendFormat("{0} = {1}", "AdvancedBorderStyle", e.AdvancedBorderStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CellBounds", e.CellBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ClipBounds", e.ClipBounds );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "FormattedValue", e.FormattedValue );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Graphics", e.Graphics );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "PaintParts", e.PaintParts );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "State", e.State );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Value", e.Value );
messageBoxCS.AppendLine();
messageBoxCS.AppendFormat("{0} = {1}", "Handled", e.Handled );
messageBoxCS.AppendLine();
MessageBox.Show(messageBoxCS.ToString(), "CellPainting Event" );
}
Private Sub DataGridView1_CellPainting(sender as Object, e as DataGridViewCellPaintingEventArgs) _
Handles DataGridView1.CellPainting
Dim messageBoxVB as New System.Text.StringBuilder()
messageBoxVB.AppendFormat("{0} = {1}", "AdvancedBorderStyle", e.AdvancedBorderStyle)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "CellBounds", e.CellBounds)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "CellStyle", e.CellStyle)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ClipBounds", e.ClipBounds)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ColumnIndex", e.ColumnIndex)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "ErrorText", e.ErrorText)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "FormattedValue", e.FormattedValue)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Graphics", e.Graphics)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "PaintParts", e.PaintParts)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "RowIndex", e.RowIndex)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "State", e.State)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Value", e.Value)
messageBoxVB.AppendLine()
messageBoxVB.AppendFormat("{0} = {1}", "Handled", e.Handled)
messageBoxVB.AppendLine()
MessageBox.Show(messageBoxVB.ToString(),"CellPainting Event")
End Sub