다음을 통해 공유


Help2.Filter 속성

컬렉션 필터를 가져오거나 설정 합니다.

네임스페이스:  Microsoft.VisualStudio.VSHelp80
어셈블리:  Microsoft.VisualStudio.VSHelp80(Microsoft.VisualStudio.VSHelp80.dll)

구문

‘선언
Property Filter As String
string Filter { get; set; }
property String^ Filter {
    String^ get ();
    void set (String^ value);
}
abstract Filter : string with get, set
function get Filter () : String 
function set Filter (value : String)

속성 값

형식: String
필터 이름이 들어 있는 문자열을 반환 합니다.

예제

만들기는 Visual Studio 추가 기능의 사용 하 여 Visual C# 에서 설명한 것 처럼 방법: 추가 기능 만들기. Add references to Microsoft.VisualStudio.VSHelp, Microsoft.VisualStudio.VSHelp80, and 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);
    }
}

.NET Framework 보안

참고 항목

참조

Help2 인터페이스

Microsoft.VisualStudio.VSHelp80 네임스페이스