Window2.ContextAttributes 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取一个 ContextAttributes 集合,该集合允许自动化客户端将新属性添加到 " 动态帮助 " 窗口中的当前选定项,并为其他特性提供上下文帮助。
public:
property EnvDTE::ContextAttributes ^ ContextAttributes { EnvDTE::ContextAttributes ^ get(); };
[System.Runtime.InteropServices.DispId(139)]
public EnvDTE.ContextAttributes ContextAttributes { [System.Runtime.InteropServices.DispId(139)] get; }
[<System.Runtime.InteropServices.DispId(139)>]
[<get: System.Runtime.InteropServices.DispId(139)>]
member this.ContextAttributes : EnvDTE.ContextAttributes
Public ReadOnly Property ContextAttributes As 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
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
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);
}