LanguagePreferences.OnRegisterMarkerType(Int32) Метод

Определение

Вызывается при регистрации нового типа маркера в 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

Параметры

iMarkerType
Int32

[in] Идентификатор типа маркера.

Возвращаемое значение

Int32

Реализации

Примеры

Ниже приведен пример того, как получить IVsTextManager2 интерфейс и получить тип маркера.

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.  
                }  
            }  
        }  
    }  
}  

Комментарии

Этот метод вызывается при каждом регистрации нового типа маркера. Вызовите GetMarkerTypeInterface метод с указанным идентификатором маркера, чтобы получить IVsTextMarkerType объект, для которого можно запросить сведения о новом типе маркера. Языковой службе обычно не требуется реализовывать этот метод.

Этот метод является реализацией Microsoft.VisualStudio.TextManager.Interop.IVsTextManagerEvents2.OnRegisterMarkerType .

Базовый метод не выполняет никаких действий.

Применяется к