LanguagePreferences.OnRegisterMarkerType(Int32) Método
Definição
Importante
Algumas informações se referem a produtos de pré-lançamento que podem ser substancialmente modificados antes do lançamento. A Microsoft não oferece garantias, expressas ou implícitas, das informações aqui fornecidas.
Chamado quando um novo tipo de marcador é registrado com o Visual Studio.
public:
virtual int OnRegisterMarkerType(int iMarkerType);
public:
virtual int OnRegisterMarkerType(int iMarkerType);
virtual int OnRegisterMarkerType(int iMarkerType);
public virtual int OnRegisterMarkerType (int iMarkerType);
abstract member OnRegisterMarkerType : int -> int
override this.OnRegisterMarkerType : int -> int
Public Overridable Function OnRegisterMarkerType (iMarkerType As Integer) As Integer
Parâmetros
- iMarkerType
- Int32
no A ID do tipo de marcador.
Retornos
Implementações
Exemplos
Aqui está um exemplo de como obter a IVsTextManager2 interface e obter o tipo de marcador.
using Microsoft.VisualStudio.Package;
namespace MyLanguagePackage
{
class MyLanguagePreferences : LanguagePreferences
{
override public void OnRegisterMarkerType(int iMarkerType)
{
IVsTextManager2 pTextManager;
pTextManager = Site.GetService(typeof(SVsTextManager)) as IVsTextManager2;
if (pTextManager != null)
{
IVsTextMarkerType pMarkerType;
pTextManager.GetMarkerTypeInterface(iMarkerType,out pMarkerType);
if (pMarkerType != null)
{
// Examine marker type here.
}
}
}
}
}
Comentários
Esse método é chamado sempre que um novo tipo de marcador é registrado. Chame o GetMarkerTypeInterface método com a ID de marcador especificada para obter um IVsTextMarkerType objeto que pode ser consultado para obter detalhes sobre o novo tipo de marcador. Um serviço de linguagem normalmente não precisa implementar esse método.
Esse método é uma implementação de Microsoft.VisualStudio.TextManager.Interop.IVsTextManagerEvents2.OnRegisterMarkerType .
O método base não faz nada.