ContextAttributes الواجهة
يحتوي على الجميع السمات المقترنة عمومي السياق أو سياق الإطار في الإطار تعليمات الحيوي.
مساحة الاسم: EnvDTE
التجميع: EnvDTE (في EnvDTE.dll)
بناء الجملة
'إقرار
<GuidAttribute("33C5EBB8-244E-449D-9CEE-FAD70A774E59")> _
Public Interface ContextAttributes _
Inherits IEnumerable
[GuidAttribute("33C5EBB8-244E-449D-9CEE-FAD70A774E59")]
public interface ContextAttributes : IEnumerable
[GuidAttribute(L"33C5EBB8-244E-449D-9CEE-FAD70A774E59")]
public interface class ContextAttributes : IEnumerable
[<GuidAttribute("33C5EBB8-244E-449D-9CEE-FAD70A774E59")>]
type ContextAttributes =
interface
interface IEnumerable
end
public interface ContextAttributes extends IEnumerable
ملاحظات
DTE.ContextAttributes، ويؤثر هذا على أكياس سياق العام، والذي له الأسبقية الدنيا لفرز المواضيع.
ل Window.ContextAttributes، ويؤثر هذا على أكياس سياق نافذة. أداة نافذة s السمات سارية المفعول فقط عند نافذة عليه تركيز. للمحررين والمصممين، السمات طويلان سارية المفعول كما المحرر هو التابعة الخاصة ب MDI نشط آخر. إذا HighPriorityAttributesخاصية هو تعيين إلى true، ثم السمات دائماً في الواقع والأعلى في الأسبقية.
بعد الحصول على ContextAttributesمجموعة، يجب استدعاء ContextAttributes.Refresh للتأكد من أن مجموعة السمات حديث، لأن إحضار الكائن ببساطة لا so. إضافة و إزالة السمات، على الرغم من ذلك، ضمنياً بتحديث ContextAttributesمجموعة حتى تصبح نتائج العمليات إضافة أو إزالة الحالي.
أمثلة
Sub ContextAttributesExample()
' Get a reference to Solution Explorer.
Dim SolnEx As Window = DTE.Windows.Item _
(Constants.vsWindowKindSolutionExplorer)
Dim CA As ContextAttribute
' List the current attributes associated with Solution Explorer.
ListAttr(SolnEx, CA)
' Associate a new F1 keyword with Solution Explorer.
SolnEx.ContextAttributes.Add("ANewKeyword", 900, _
vsContextAttributeType.vsContextAttributeLookupF1)
ListAttr(SolnEx, CA)
' Delete the new F1 keyword from Solution Explorer.
SolnEx.ContextAttributes.Item(3).Remove()
ListAttr(SolnEx, CA)
End Sub
Sub ListAttr(ByVal SolnEx As Object, ByVal CA As ContextAttribute)
' Support function for CATest(). Lists the current attributes
' associated with Solution Explorer.
Dim msg As String
MsgBox("Number of context attributes in Solution Explorer: " & _
SolnEx.ContextAttributes.Count)
For Each CA In SolnEx.ContextAttributes
msg = msg & CA.Name & Chr(13)
Next
MsgBox(msg)
msg = ""
End Sub