Задайте вопросЗадайте вопрос
 

ОтвеченоAdding controls to toolbox

  • 5 октября 2007 г. 18:33Somesh Chandra Медали пользователяМедали пользователяМедали пользователяМедали пользователяМедали пользователя
     

    Hi,

     

    I am working on vb.net (framework 2.0). Based on some rule my AddIn is supposed to create a new tooltab in toolbox. After creating a tool tab, customized .net controls are required to be added in to the tooltab so that when I open the toolbox (from view->toolbox menu option) then I can see the newly added tooltaba and controls within it.

     

    I have written following code in my AddIn. This is supposed to create a toolbox tab and add a user created .net button control. It only seems to be adding toolbox tab but control is not added to the tool box. Any idea why ?

     

    Dim pTlBox As ToolBox

    Dim pTbxTabs As ToolBoxTabs

    Dim pTbxTab As ToolBoxTab

     

    ' Create an object reference to the IDE's ToolBox object and its tabs.

    pTlBox = mDTE.Windows.Item(Constants.vsWindowKindToolbox).Object

    pTbxTabs = pTlBox.ToolBoxTabs

     

    mDTE.Windows.Item(Constants.vsWindowKindToolbox).Visible = True

    mDTE.Windows.Item(Constants.vsWindowKindToolbox).Activate()

     

    ' Add a new tab to the Toolbox

    pTbxTab = pTbxTabs.Add("My Tools")

    pTbxTab.Activate()

     

    pTbxTab.ToolBoxItems.Item(1).Select()

    pTbxTab.ToolBoxItems.Add("My Button", "C:\MyButton.dll", vsToolBoxItemFormat.vsToolBoxItemFormatDotNETComponent)

     

     

    Thanks,

    Somesh

     

Ответы

Все ответы