DataGridViewCell.GetInheritedContextMenuStrip メソッドとは? わかりやすく解説

Weblio 辞書 > コンピュータ > .NET Framework クラス ライブラリ リファレンス > DataGridViewCell.GetInheritedContextMenuStrip メソッドの意味・解説 

DataGridViewCell.GetInheritedContextMenuStrip メソッド

メモ : このメソッドは、.NET Framework version 2.0 で新しく追加されたものです。

現在のセルの継承されたショートカット メニューを取得します。

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

Public Overridable Function
 GetInheritedContextMenuStrip ( _
    rowIndex As Integer _
) As ContextMenuStrip
Dim instance As DataGridViewCell
Dim rowIndex As Integer
Dim returnValue As ContextMenuStrip

returnValue = instance.GetInheritedContextMenuStrip(rowIndex)
public virtual ContextMenuStrip GetInheritedContextMenuStrip (
    int rowIndex
)
public:
virtual ContextMenuStrip^ GetInheritedContextMenuStrip (
    int rowIndex
)
public ContextMenuStrip GetInheritedContextMenuStrip (
    int rowIndex
)
public function GetInheritedContextMenuStrip
 (
    rowIndex : int
) : ContextMenuStrip

パラメータ

rowIndex

現在のセルの行インデックス。

戻り値
親の DataGridView、DataGridViewRow、または DataGridViewColumn に割り当てられた ContextMenuStrip がある場合は ContextMenuStrip。それ以外の場合は null 参照 (Visual Basic では Nothing)。

例外例外
例外の種類条件

ArgumentOutOfRangeException

セルの DataGridView プロパティが null 参照 (Visual Basic では Nothing) ではなく、指定した rowIndex が 0 未満か、コントロールに含まれる行数から 1 を引いた値を上回っています。

InvalidOperationException

ColumnIndex が 0 未満です。これは、セルが行ヘッダーのセルであることを示します。

解説解説

セルに関連付けられた ContextMenuStrip がない場合、次の優先順位を使用して、いずれかの親から継承されます。

  1. このセルの ContextMenuStrip

  2. そのセルを所有している行の DataGridViewRow.ContextMenuStrip

  3. そのセルを所有している列の DataGridViewColumn.ContextMenuStrip

  4. 親テーブルの System.Windows.Forms.ContextMenuStrip

ショートカット メニューは Microsoft Windows ネイティブのリソースで、その有効期間は通常、Dispose メソッドまたはデストラクタによって指示されます。

GetInheritedContextMenuStrip メソッドに、DataGridViewCell を取得するために使用した行インデックスを渡します。RowIndex プロパティは rowIndex パラメータに使用しないでください。行が共有されている場合、RowIndex は -1 となり、これは rowIndex の有効な値ではありません。

プラットフォームプラットフォーム
バージョン情報バージョン情報
参照参照
関連項目
DataGridViewCell クラス
DataGridViewCell メンバ
System.Windows.Forms 名前空間
DataGridView クラス
ContextMenuStrip
Control.ContextMenuStrip プロパティ
ContextMenuStrip クラス
DataGridViewRow
DataGridViewColumn



英和和英テキスト翻訳

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

辞書ショートカット

すべての辞書の索引

DataGridViewCell.GetInheritedContextMenuStrip メソッドのお隣キーワード
検索ランキング

   

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



DataGridViewCell.GetInheritedContextMenuStrip メソッドのページの著作権

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

©2026 GRAS Group, Inc.RSS