Partilhar via


Propriedade Help2.Filter

Obtém ou define o filtro da coleção.

Namespace:  Microsoft.VisualStudio.VSHelp80
Assembly:  Microsoft.VisualStudio.VSHelp80 (em Microsoft.VisualStudio.VSHelp80.dll)

Sintaxe

'Declaração
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)

Valor de propriedade

Tipo: String
Retorna um string que contém o nome do filtro.

Exemplos

Criar um Visual Studio suplemento usando Visual C# conforme descrito em Como criar um suplemento. Add references to Microsoft.VisualStudio.VSHelp, Microsoft.VisualStudio.VSHelp80, and System.Windows.Forms. Substitua o código na OnConnection método no arquivo Connect. cs com o código a seguir. Executar o exemplo de código, conforme descrito em Como compilar e executar os exemplos de código do modelo de objeto Automation.

Dica

Certifique-se de definir um filtro na Visual Studio ajuda a coleção antes de executar este exemplo.Caso contrário, o método retornará uma exceção nula.

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);
    }
}

Segurança do .NET Framework

Consulte também

Referência

Help2 Interface

Namespace Microsoft.VisualStudio.VSHelp80