如何向 Visual Studio 2010 扩展添加新图标? [英] how can i add a new icon to a Visual Studio 2010 extension?

查看:71
本文介绍了如何向 Visual Studio 2010 扩展添加新图标?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Visual Studio 2010 扩展,我的窗口中已经有一个工具栏.在那个工具栏上,我有一个按钮,我想给它一个图标 - 我自己的图标!我已阅读

i'm developing a Visual Studio 2010 extension, i already have a toolbar inside my window. on that toolbar i have a button that i want to give an icon - my own icon! I've read this article and it is great but... it explains how to replace the icons.

i want to add an additional icon.

how do i achieve that?

解决方案

First, add the bitmap and set its build action to Resource

Remember, shocking pink = transparent (damn you, old school!)

Then, in your vsct file, add the image to the bitmaps section

<Bitmaps>
    <Bitmap guid="AddSampleData.bmpGuid"
            href="..\Button Bitmaps\AddSampleData.bmp"
            usedList="AddSampleData.bmpId" />
    <Bitmap guid="ApplySampleData.bmpGuid"
            href="..\Button Bitmaps\ApplySampleData.bmp"
            usedList="ApplySampleData.bmpId" />
</Bitmaps>

and assign it a guid in the symbols node

<Symbols>
    <!-- snip -->
    <GuidSymbol name="AddSampleData.bmpGuid"
                value="{dcae7c84-8e91-4f8a-907b-95ccb0f52e6e}">
        <IDSymbol name="AddSampleData.bmpId"
                    value="1" />
    </GuidSymbol>
    <GuidSymbol name="ApplySampleData.bmpGuid"
                value="{9f555245-2430-4e6f-992b-b49ce87a31a2}">
        <IDSymbol name="ApplySampleData.bmpId"
                    value="1" />
    </GuidSymbol>
</Symbols>

and apply it to a button

<Buttons>
<!-- snip -->
    <Button guid="guidEditorExtensionCommandSet"
            id="setDesignTimeDataOnPage"
            priority="0x0100">
        <Icon guid="ApplySampleData.bmpGuid"
                id="ApplySampleData.bmpId" />
        <Strings>
                    <!-- snip -->
        </Strings>
    </Button>
</Buttons>

Of course, its always easier to use the available tools, including the excellent VSPackage Builder extension.

这篇关于如何向 Visual Studio 2010 扩展添加新图标?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆