Help2.Filter 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取或设置集合筛选器。
public:
property System::String ^ Filter { System::String ^ get(); void set(System::String ^ value); };
public:
property Platform::String ^ Filter { Platform::String ^ get(); void set(Platform::String ^ value); };
[System.Runtime.InteropServices.DispId(22)]
public string Filter { [System.Runtime.InteropServices.DispId(22)] get; [System.Runtime.InteropServices.DispId(22)] set; }
[<System.Runtime.InteropServices.DispId(22)>]
[<get: System.Runtime.InteropServices.DispId(22)>]
[<set: System.Runtime.InteropServices.DispId(22)>]
member this.Filter : string with get, set
Public Property Filter As String
属性值
返回一个包含筛选器名称的字符串。
实现
- 属性
示例
使用创建外接程序, Visual Studio Visual C# 如 如何:创建外接程序中所述。 添加对 Microsoft.VisualStudio.VSHelp 、 Microsoft.VisualStudio.VSHelp80 和的引用 System.Windows.Forms 。 将 OnConnection Connect.cs 文件中方法中的代码替换为以下代码。 按照 如何:编译和运行自动化对象模型代码示例中所述运行代码示例。
备注
运行此示例之前,请务必在帮助集合上设置筛选器 Visual Studio 。 否则,该方法将返回 null 异常。
using System;
using Extensibility;
using EnvDTE;
using EnvDTE80;
using Microsoft.VisualStudio.VSHelp;
using Microsoft.VisualStudio.VSHelp80;
using System.Windows.Forms;
public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
HelpFilterExample(_applicationObject);
}
public void HelpFilterExample(DTE2 dte)
{
// This add-in displays a message box with the filter applied to
// the active Help collection.
// inIt then changes the filter
// and displays the Contents window of Document
// Explorer with the new filter applied.
try
{
Microsoft.VisualStudio.VSHelp80.Help2 help2 =
(Microsoft.VisualStudio.VSHelp80.Help2)_applicationObject.GetObject ("Help2");
// Display the name of the filter.
MessageBox.Show("The Help filter name is: "
help2.Filter.ToString());
// Set the filter to Visual C#.
help2.Filter = "Visual C#";
// Set the focus to the Contents window and
// open Document Explorer.
help2.Contents();
}
catch (SystemException ex)
{
MessageBox.Show("ERROR: " + ex);
}
}