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 的值可以是一个整数,表示某个 ColorableItems 对象在其 FontsAndColorsItems 集合中的索引;也可以是等同于该集合中某个 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 命名空间

其他资源

如何:编译和运行自动化对象模型代码示例