共用方式為


ContextAttributes.HighPriorityAttributes 屬性

取得 High Priority 屬性集合。

命名空間:  EnvDTE
組件:  EnvDTE (在 EnvDTE.dll 中)

語法

'宣告
ReadOnly Property HighPriorityAttributes As ContextAttributes
ContextAttributes HighPriorityAttributes { get; }
property ContextAttributes^ HighPriorityAttributes {
    ContextAttributes^ get ();
}
abstract HighPriorityAttributes : ContextAttributes
function get HighPriorityAttributes () : ContextAttributes

屬性值

型別:EnvDTE.ContextAttributes
ContextAttributes 集合。

備註

這個屬性集合只有一個執行個體,只能從 ContextAttributes 集合中使用。如果 ContextAttributes 集合是用於視窗,則 HighPriorityAttributes 不會傳回任何值。

這些屬性 (Attribute) 永遠生效,而且在內容包中有最高的優先順序,使得相符主題在各分類中也有最高的優先順序。

範例

    Sub HighPriorityAttributesExample()
        Dim cas As EnvDTE.ContextAttributes
        Dim ca As EnvDTE.ContextAttribute

        Try
            cas = DTE.ContextAttributes
            ' List all regular and high priority attributes.
            ListAttr(ca, cas)
            ' Add a new F1 keyword to the global high priority 
            ' attributes collection.
            cas.HighPriorityAttributes.Add("NewAttribute", _
            "NewF1Keyword", vsContextAttributeType. _
            vsContextAttributeLookupF1)
            ListAttr(ca, cas)
            ' Remove the new high priority attribute.
            cas.HighPriorityAttributes.Item(1).Remove()
            ListAttr(ca, cas)
        Catch ex As System.Exception
            MsgBox("ERROR: " & ex.Message)
        End Try
    End Sub

    Function ListAttr(ByVal ca As ContextAttribute, ByVal cas As _
    ContextAttributes)
        Dim msg As String

        Try
            ' List regular attributes, their first value, and their count.
            For Each ca In cas
                msg = msg & ca.Name & "  " & ca.Values(0) & vbCr
            Next
            cas.Refresh()
            MsgBox("All Attributes: " & vbCr & msg & "Count: " & _
            cas.Count)

            ' List high-priority attributes, their first value, 
            ' and their count.
            msg = ""
            For Each ca In cas.HighPriorityAttributes
                msg = msg & ca.Name & "  " & ca.Values(0) & vbCr
            Next
            cas.Refresh()
            MsgBox("High-Priority Attributes: " & vbCr & msg & "Count: " _
            & cas.HighPriorityAttributes.Count)
        Catch ex As System.Exception
            MsgBox("ERROR: " & ex.Message)
        End Try
    End Function

.NET Framework 安全性

請參閱

參考

ContextAttributes 介面

EnvDTE 命名空間