次の方法で共有


Window.ContextAttributes プロパティ

更新 : 2007 年 11 月

ContextAttributes コレクションを取得します。このコレクションを使用すると、オートメーション クライアントは、[ダイナミック ヘルプ] ウィンドウで現在選択されている項目に新しい属性を追加し、追加した属性のコンテキスト ヘルプを表示できます。

名前空間 :  EnvDTE
アセンブリ :  EnvDTE (EnvDTE.dll 内)

構文

'宣言
ReadOnly Property ContextAttributes As ContextAttributes
'使用
Dim instance As Window
Dim value As ContextAttributes

value = instance.ContextAttributes
ContextAttributes ContextAttributes { get; }
property ContextAttributes^ ContextAttributes {
    ContextAttributes^ get ();
}
function get ContextAttributes () : ContextAttributes

プロパティ値

型 : EnvDTE.ContextAttributes

ContextAttributes コレクション。

Sub ContextAttributesExample(ByVal dte As DTE2)

    ' List the current context attributes associated with 
    ' Solution Explorer.
    Dim explorerWin As Window = dte.ToolWindows.SolutionExplorer.Parent
    Dim attrs As String
    Dim attr As ContextAttribute

    For Each attr In explorerWin.ContextAttributes
        attrs &= attr.Name & vbCrLf
    Next

    MsgBox("Solution Explorer has the following context attributes:" _
        & vbCrLf & vbCrLf & attrs)

    ' Associate a new F1 keyword with Solution Explorer.
    explorerWin.ContextAttributes.Add("ANewKeyword", "900", _
        vsContextAttributeType.vsContextAttributeLookupF1)

    attrs = ""
    For Each attr In explorerWin.ContextAttributes
        attrs &= attr.Name & vbCrLf
    Next

    MsgBox("Solution Explorer has the following context attributes:" _
        & vbCrLf & vbCrLf & attrs)

End Sub
public void ContextAttributeExample(DTE2 dte)
{
    // List the current context attributes associated with 
    // Solution Explorer.
    Window explorerWin = dte.ToolWindows.SolutionExplorer.Parent;
    string attrs = "";

    foreach (ContextAttribute attr in explorerWin.ContextAttributes)
        attrs += attr.Name + "\n";

    MessageBox.Show(
        "Solution Explorer has the following context attributes:\n\n" + 
        attrs);

    // Associate a new F1 keyword with Solution Explorer.
    explorerWin.ContextAttributes.Add("ANewKeyword", "900", 
        vsContextAttributeType.vsContextAttributeLookupF1);

    attrs = "";
    foreach (ContextAttribute attr in explorerWin.ContextAttributes)
        attrs += attr.Name + "\n";

    MessageBox.Show(
        "Solution Explorer has the following context attributes:\n\n" + 
        attrs);
}

アクセス許可

  • 直前の呼び出し元に対する完全な信頼。このメンバは、部分的に信頼されているコードから使用することはできません。詳細については、「部分信頼コードからのライブラリの使用」を参照してください。

参照

参照

Window インターフェイス

Window メンバ

EnvDTE 名前空間

その他の技術情報

方法 : オートメーション オブジェクト モデルのコード例をコンパイルおよび実行する