LanguagePreferences.OnRegisterMarkerType(Int32) Método

Definição

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

Int32

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.

Aplica-se a