DataGridViewRowPostPaintEventArgs.RowIndex プロパティとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewRowPostPaintEventArgs.RowIndex プロパティの意味・解説 

DataGridViewRowPostPaintEventArgs.RowIndex プロパティ

メモ : このプロパティは、.NET Framework version 2.0新しく追加されたものです。

現在の DataGridViewRow のインデックス取得します

名前空間: System.Windows.Forms
アセンブリ: System.Windows.Forms (system.windows.forms.dll 内)
構文構文

Dim instance As DataGridViewRowPostPaintEventArgs
Dim value As Integer

value = instance.RowIndex
public int RowIndex { get;
 }
public:
property int RowIndex {
    int get ();
}
/** @property */
public int get_RowIndex ()

プロパティ
現在の DataGridViewRowインデックス

解説解説

この行インデックス使用して、DataGridViewRowCollection 内の現在の行にアクセスできます

使用例使用例

RowIndex プロパティ使用して現在の行にアクセスする方法次のコード例示します。このコードでは、選択された行3 番目の列の交差位置にあるセルの値を取得した後、この値を行全体描画ます。変数 e の型が DataGridViewRowPostPaintEventArgs です。次のコード例は、「方法 : Windows フォームの DataGridView コントロールの行の外観カスタマイズする」で示されている例の一部です。

' Get the content that spans multiple columns.
Dim recipe As Object = _
    Me.dataGridView1.Rows.SharedRow(e.RowIndex).Cells(2).Value

If Not (recipe Is Nothing)
 Then
    Dim text As String =
 recipe.ToString()

    ' Calculate the bounds for the content that spans multiple 
    ' columns, adjusting for the horizontal scrolling position 
    ' and the current row height, and displaying only whole
    ' lines of text.
    Dim textArea As Rectangle = rowBounds
    textArea.X -= Me.dataGridView1.HorizontalScrollingOffset
    textArea.Width += Me.dataGridView1.HorizontalScrollingOffset
    textArea.Y += rowBounds.Height - e.InheritedRowStyle.Padding.Bottom
    textArea.Height -= rowBounds.Height - e.InheritedRowStyle.Padding.Bottom
    textArea.Height = (textArea.Height \ e.InheritedRowStyle.Font.Height) * _
        e.InheritedRowStyle.Font.Height

    ' Calculate the portion of the text area that needs painting.
    Dim clip As RectangleF = textArea
    clip.Width -= Me.dataGridView1.RowHeadersWidth + 1 - clip.X
    clip.X = Me.dataGridView1.RowHeadersWidth + 1
    Dim oldClip As RectangleF = e.Graphics.ClipBounds
    e.Graphics.SetClip(clip)

    ' Draw the content that spans multiple columns.
    e.Graphics.DrawString(text, e.InheritedRowStyle.Font, forebrush, _
        textArea)

    e.Graphics.SetClip(oldClip)
End If
// Get the content that spans multiple columns.
object recipe =
    this.dataGridView1.Rows.SharedRow(e.RowIndex).Cells[2].Value;

if (recipe != null)
{
    String text = recipe.ToString();

    // Calculate the bounds for the content that spans multiple 
    // columns, adjusting for the horizontal scrolling position 
    // and the current row height, and displaying only whole
    // lines of text.
    Rectangle textArea = rowBounds;
    textArea.X -= this.dataGridView1.HorizontalScrollingOffset;
    textArea.Width += this.dataGridView1.HorizontalScrollingOffset;
    textArea.Y += rowBounds.Height - e.InheritedRowStyle.Padding.Bottom;
    textArea.Height -= rowBounds.Height -
        e.InheritedRowStyle.Padding.Bottom;
    textArea.Height = (textArea.Height / e.InheritedRowStyle.Font.Height) *
        e.InheritedRowStyle.Font.Height;

    // Calculate the portion of the text area that needs painting.
    RectangleF clip = textArea;
    clip.Width -= this.dataGridView1.RowHeadersWidth + 1 - clip.X;
    clip.X = this.dataGridView1.RowHeadersWidth + 1;
    RectangleF oldClip = e.Graphics.ClipBounds;
    e.Graphics.SetClip(clip);

    // Draw the content that spans multiple columns.
    e.Graphics.DrawString(
        text, e.InheritedRowStyle.Font, forebrush, textArea);

    e.Graphics.SetClip(oldClip);
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewRowPostPaintEventArgs クラス
DataGridViewRowPostPaintEventArgs メンバ
System.Windows.Forms 名前空間
DataGridView クラス
DataGridViewRow クラス



英和和英テキスト翻訳>> Weblio翻訳
英語⇒日本語日本語⇒英語
  

辞書ショートカット

すべての辞書の索引

「DataGridViewRowPostPaintEventArgs.RowIndex プロパティ」の関連用語

DataGridViewRowPostPaintEventArgs.RowIndex プロパティのお隣キーワード
検索ランキング

   

英語⇒日本語
日本語⇒英語
   



DataGridViewRowPostPaintEventArgs.RowIndex プロパティのページの著作権
Weblio 辞書 情報提供元は 参加元一覧 にて確認できます。

   
日本マイクロソフト株式会社日本マイクロソフト株式会社
© 2024 Microsoft.All rights reserved.

©2024 GRAS Group, Inc.RSS