Visual Studio扩展 [英] Visual Studio extension

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

问题描述





前段时间我为VS2010写了一个扩展程序。在得知它可能仍在使用之后,发布它,即使我对它的外观也不完全满意。



我说的是一个带有按钮的工具栏您计算机上安装的每个Web浏览器。您可以按下按钮,下次您的Web应用程序将在所选浏览器中运行。



我有两个问题...



动态创建的按钮如下:

Hi,

I wrote a extension for VS2010 some time ago. After learning that it may have still use, published it, even I'm not fully satisfied with it's look.

I'm talking about a toolbar that has button for every web browser installed on your machine. You can push the button and next time your web application will run in the selected browser.

I have two questions...

The buttons created dynamically like this:

private void BeforeQueryStatus ( object sender, EventArgs e )
{
    OleMenuCommand oOleMenuCommand = ( OleMenuCommand )sender;

    if ( oOleMenuCommand != null )
    {
        int nIndex = oOleMenuCommand.CommandID.ID - ( int )Consts.BrowsersListButton;

        oOleMenuCommand.Checked = nIndex == _Current;

        oOleMenuCommand.Text = ( ( BrowserCaps )_Browsers[ nIndex ] ).DisplayName;
    }
}



其中 _Browsers 是您机​​器上的浏览器列表...



我的问题是我更喜欢显示图像而不是名字,但是没有办法从外部源动态地向按钮添加图像。 。



另一个问题与工具栏的自定义有关。像VS内置工具栏一样,我的工具栏也需要定制重新设计。我不想要这个。在vsct文件中,我声明了工具栏和没有自定义选项的按钮:




Where _Browsers is a list of the browsers found on your machine...

My problem is that I prefer to display images and not names, but found no way to add image to the button, dynamically, from external source...

The other problem is connected to the customization of toolbar. Like VS built-in toolbars, my one also subject to custom re-design. I do not want this. In the vsct file I declared the toolbar and the button with no-customize option:

<Menu guid="CMD_SET" id="BrowsersListToolbar" type="Toolbar" priority="0">
    <Parent guid="CMD_SET" id="BrowsersListToolbar" />
    <CommandFlag>NoCustomize</CommandFlag>
    <Strings>
        <ButtonText>Web Browser Selector</ButtonText>
    </Strings>
</Menu>







<Button guid="CMD_SET" id="BrowsersListButton" type="Button" priority="0">
    <Parent guid="CMD_SET" id="BrowsersListGroup" />
    <CommandFlag>DynamicItemStart</CommandFlag>
    <CommandFlag>TextChanges</CommandFlag>
    <CommandFlag>IconAndText</CommandFlag>
    <CommandFlag>NoButtonCustomize</CommandFlag>
    <Strings>
        <ButtonText>[Browsers List]</ButtonText>
    </Strings>
</Button>



这似乎什么都不做......



有一些建议吗?



谢谢

彼得


This seems do nothing...

There are some suggestions?

Thanks
Peter

推荐答案

看看我的文章,编号书签 - Visual Studio Extension VSX 2010 [ ^ ]。它涵盖了使用图像菜单项,其中一些可能会有所帮助。
Take a look at my article, Numbered Bookmarks - Visual Studio Extension VSX 2010[^]. It covers using Images for Menu items and some of that can be helpful.


这篇关于Visual Studio扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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