VCCodeElement 介面

用來存取原始程式檔 (Source File) 中任何程式碼項目的物件。

命名空間:  Microsoft.VisualStudio.VCCodeModel
組件:  Microsoft.VisualStudio.VCCodeModel (在 Microsoft.VisualStudio.VCCodeModel.dll 中)

語法

'宣告
<GuidAttribute("CF8017FE-6514-49BC-9CA2-6B4882C4C1A0")> _
Public Interface VCCodeElement
[GuidAttribute("CF8017FE-6514-49BC-9CA2-6B4882C4C1A0")]
public interface VCCodeElement
[GuidAttribute(L"CF8017FE-6514-49BC-9CA2-6B4882C4C1A0")]
public interface class VCCodeElement
[<GuidAttribute("CF8017FE-6514-49BC-9CA2-6B4882C4C1A0")>]
type VCCodeElement =  interface end
public interface VCCodeElement

VCCodeElement 型別會公開下列成員。

屬性

  名稱 說明
公用屬性 Attributes 取得父物件所有屬性的集合。
公用屬性 Children 取得這個程式碼建構內所含物件的集合。
公用屬性 CodeModel 取得此專案的 VCCodeModel 物件。
公用屬性 Collection 取得集合,這個集合包含支援這個屬性的物件或這個程式碼建構內所含的物件。
公用屬性 Comment 取得或設定與此程式碼項目關聯的註解。
公用屬性 DisplayName 取得 VCCodeElement 物件的顯示名稱。
公用屬性 DTE 取得最上層的擴充性物件。
公用屬性 EndPoint 取得編輯點,此編輯點為程式碼項目結尾的位置。
公用屬性 EndPointOf 傳回 VCCodeElement 物件的結束點。
公用屬性 Extender 傳回要求的擴充項物件 (如果適用於這個物件)。
公用屬性 ExtenderCATID 取得物件的擴充項分類 ID (CATID)。
公用屬性 ExtenderNames 取得物件的可用擴充項清單。
公用屬性 File 取得與這個 VCCodeElement 物件相關聯的檔案。
公用屬性 FullName 取得物件檔案的完整路徑和名稱。
公用屬性 InfoLocation 說明程式碼模型的功能。
公用屬性 IsCaseSensitive 取得值,這個值表示程式碼項目是否區分大小寫。
公用屬性 IsCodeType 取得值,這個值表示是否可以從此物件取得 CodeType 物件。
公用屬性 IsInjected 取得值,這個值表示程式碼項目是否已經由屬性或巨集展開插入。
公用屬性 IsReadOnly 取得值,這個值表示包含 VCCodeElement 物件的檔案是否為唯讀。
公用屬性 IsZombie 取得值,這個值表示 VCCodeElement 物件是否存在。
公用屬性 Kind 取得列舉型別,指出物件型別。
公用屬性 Language 取得用來撰寫程式碼的程式語言。
公用屬性 Location 取得父物件宣告的位置。
公用屬性 Name 取得或設定物件的名稱。
公用屬性 Parent 取得指定物件的直接上層父物件。
公用屬性 Picture 取得要在使用者介面中當做圖示使用的圖片 Automation 物件。
公用屬性 Project 取得與物件相關聯的 Project 物件。
公用屬性 ProjectItem 取得與指定物件關聯的 ProjectItem 物件。
公用屬性 References 目前未實作。
公用屬性 StartPoint 取得 TextPoint 物件,用以定義程式碼項目的開頭。
公用屬性 StartPointOf 取得父物件的起始點。

回頁首

方法

  名稱 說明
公用方法 GetEndPoint TextPoint 物件,用以標示程式碼項目定義的結尾。
公用方法 GetStartPoint TextPoint 物件,用以定義程式碼項目定義的開頭。
公用方法 IsSelf 判斷指定的程式碼項目是否與另一個程式碼項目相同。

回頁首

備註

VCCodeElement物件提供了現有的 Visual C++ 程式碼模型的功能整合開發環境 (IDE) 的程式碼項目層級的解決方案。主要的是,這個物件用來找出並修改任何程式碼元素 (類別宣告、 識別項、 函式定義等等) 的原始程式檔中存取。

注意事項注意事項

大部分的這個物件的功能由 Visual Studio CodeElement物件。如需詳細資訊,請參閱 CodeElement 物件。

如需這個範例的編譯與執行等詳細資訊,請參閱 HOW TO:編譯 Visual C++ 程式碼模型擴充性的範例程式碼

範例

本範例將指定的新加入的類別,以VCCodeElement物件。

Sub GetVCCodeElement()
    Dim vcCM As VCCodeModel
    Dim vcCodeElement As VCCodeElement
    vcCM = DTE.Solution.Item(1).CodeModel
    vcCodeElement = vcCM.AddClass("MyClass", "MyClass.h")
End Sub

請參閱

參考

Microsoft.VisualStudio.VCCodeModel 命名空間