共用方式為


FontsAndColorsItems.Item 方法

傳回在 FontsAndColorsItems 集合中的 ColorableItems 物件。

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

語法

'宣告
Function Item ( _
    index As Object _
) As ColorableItems
ColorableItems Item(
    Object index
)
ColorableItems^ Item(
    [InAttribute] Object^ index
)
abstract Item : 
        index:Object -> ColorableItems 
function Item(
    index : Object
) : ColorableItems

參數

傳回值

型別:EnvDTE.ColorableItems
ColorableItems 物件。

備註

傳遞到 Index 的值,可以為 FontsAndColorsItems 集合中 ColorableItems 物件之索引的整數值,或是與集合中 ColorableItems 物件相同的字串值。

如果集合無法找到對應於索引值的物件,Item 方法就會擲回 ArgumentException 例外狀況。

範例

public void CodeExample(DTE2 dte, AddIn addin)
{   // Make sure you have an open solution
    try
    {
        Properties props;
        Property prop;
        FontsAndColorsItems fci;
        ColorableItems ci;
        string msg = "";
        props = dte.get_Properties("FontsAndColors", "TextEditor");
        prop = props.Item("FontsAndColorsItems");
        fci = (FontsAndColorsItems)prop.Object;
        ci = fci.Item(1);
        msg += "Count of ColorableItems in fci: " + fci.Count + "\n";
        msg += "The first ColorableItems object in fci is " + ci.Name;
        MessageBox.Show(msg);
    }
    catch(Exception ex)
    {
        MessageBox.Show(ex.Message);
    }
}

.NET Framework 安全性

請參閱

參考

FontsAndColorsItems 介面

EnvDTE 命名空間

其他資源

HOW TO:編譯和執行 Automation 物件模型程式碼範例