![](/img/trans.png)
[英]How to implement the default outlining tool tip in Visual Studio extension?
[英]How to add additional tool windows to a Visual Studio Extension?
我創建了一個指南:
HOWTO:在Visual Studio包中創建一個帶有ToolWindowPane類的工具窗口http://www.visualstudioextensibility.com/2015/02/20/mz-tools-articles-series-howto-create-a-toolwindow-with-a- toolwindowpane級-IN-A-視覺工作室封裝/
我剛剛找到了一些東西 - 所以我要回答我自己的問題,以便其他有相同問題的人可以利用它:
按照本教程設置擴展,但選中“ 工具窗口 ”
為ToolWindow“ ToolWindow2Control ”創建一個新的UserControl,並相應地粘貼ToolWindowControl.xaml和ToolWindowControl.xaml.cs的內容
添加一個類“ ToolWindow2 ”並復制粘貼ToolWindow.cs中的內容。 將GUID更改為新GUID(工具 - >創建GUID)
在NameOfYourProject.vsct中,通過復制Buttons部分中的Button,添加用於在View-> Other Windows中顯示第二個條目的代碼。 更改ButtonText,優先級,Button的id和Icon的id。
將Button的id添加到頁面底部的Symbols下的條目中。 它應該是guidNameOfYourProjectCmdSet下的第三個條目。
打開PkgCmdID.cs (或PkgCmdIDList.cs )並在那里添加Button的id,例如
public const uint cmdidMyTool2 = 0x102;
在項目/資源中添加另一個圖標。 然后在NameOfYourProject.vsct的位圖部分中添加另一個Bitmap條目, 其中包含您之前為Icon提供的GUID-id。 像這樣:
<Bitmap guid="guidImages2" href="Images\\test.ico" usedList="testIcon"/>
並在Symbols部分創建另一個GuidSymbol條目,其中包含一個新的GUID和一個IDSymbol條目,該條目與您在usedList中使用的條目具有相同的名稱,如下所示:
<GuidSymbol name="guidImages2" value="{7BC1F97F-2693-4186-91CC-A35AE95886CE}" > <IDSymbol name="testIcon" value="1" /> </GuidSymbol>
將此行添加到NameOfYourProjectPackage.cs :
[ProvideToolWindow(typeof(ToolWindow2))]
在NameOfYourProjectPackage.cs中 ,通過復制粘貼// Create the command for the tool window
下方// Create the command for the tool window
下的3行來編輯Initialize方法。 在第一行中使用我們在步驟#6中給出的id( cmdidMyTool2 )。 在第二行中使用新的MenuCommand事件處理程序ShowToolWindow2 。 並更改變量名稱。
創建一個新方法ShowToolWindow2 。 從ShowToolWindow方法復制粘貼並將第一行中的typeof更改為ToolWindow2
這應該是它。 我希望我沒有忘記任何事情。 然后,您可以在Views-> Other Windows下打開兩個窗口
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.