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

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

DataGridView.FirstDisplayedCell プロパティ

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

DataGridView に現在表示されている最初のセルを取得または設定します。通常、このセルは左上隅にあります。

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

Public Property FirstDisplayedCell As
 DataGridViewCell
Dim instance As DataGridView
Dim value As DataGridViewCell

value = instance.FirstDisplayedCell

instance.FirstDisplayedCell = value
public DataGridViewCell FirstDisplayedCell { get;
 set; }
public:
property DataGridViewCell^ FirstDisplayedCell {
    DataGridViewCell^ get ();
    void set (DataGridViewCell^ value);
}
/** @property */
public DataGridViewCell get_FirstDisplayedCell ()

/** @property */
public void set_FirstDisplayedCell (DataGridViewCell
 value)
public function get FirstDisplayedCell
 () : DataGridViewCell

public function set FirstDisplayedCell
 (value : DataGridViewCell)

プロパティ値
現在コントロールに表示されている最初の DataGridViewCell。

例外例外
例外の種類条件

ArgumentException

このプロパティの設定時に指定されたセルが DataGridView にありません。

InvalidOperationException

このプロパティの設定時に指定されたセルには、RowIndex プロパティまたは ColumnIndex プロパティの値として -1 が設定されています。これは、ヘッダー セルまたは共有セルを示します。

または

このプロパティの設定時に指定されたセルには、Visible プロパティの値として false が設定されています。

解説解説
使用例使用例

現在のセルが並べ替えの後に表示されるようにするコード例を次に示します。このコードは、バインドされていない DataGridView コントロールでだけ使用できます。外部データ ソースにバインドされた DataGridView コントロールの場合、現在のセルは、並べ替え時に自動的に永続化されません。

この例を実行するには、dataGridView1 という名前の DataGridView が配置されているフォームに、次のコードを貼り付けます。C# では、Sorted イベントをイベント ハンドラに関連付ける必要もあります。

Private Sub dataGridView1_Sorted(ByVal
 sender As Object, _
    ByVal e As System.EventArgs) Handles
 dataGridView1.Sorted

    Me.dataGridView1.FirstDisplayedCell = Me.dataGridView1.CurrentCell

End Sub
private void dataGridView1_Sorted(object sender,
 EventArgs e)
{
    this.dataGridView1.FirstDisplayedCell = this.dataGridView1.CurrentCell;
}
プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

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

   

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



DataGridView.FirstDisplayedCell プロパティのページの著作権

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

©2026 GRAS Group, Inc.RSS