2011-03-16 100 views
5

当你在Visual Studio中查看项目属性时,你会得到许多选项卡。如何在Visual Studio中扩展项目属性屏幕?

标准的有“应用程序”,“建设”,“建设活动”等

也可以添加自定义选项卡。例如,查看WebApplication或VSIX项目的属性,可以获得不同(额外)的选项卡。

那么如何编写一个VSIX插件,它将自定义选项卡添加到项目属性窗口中?

回答

3

看看这篇文章:How to: Add and Remove Property Pages

您创建一个页面,如下所示:

class DeployPropertyPage : Form, Microsoft.VisualStudio.OLE.Interop.IPropertyPage 
{ 
    . . . . 
    //Summary: Return a stucture describing your property page. 
    public void GetPageInfo(Microsoft.VisualStudio.OLE.Interop.PROPPAGEINFO[] pPageInfo) 
    { 
     PROPPAGEINFO info = new PROPPAGEINFO(); 
     info.cb = (uint)Marshal.SizeOf(typeof(PROPPAGEINFO)); 
     info.dwHelpContext = 0; 
     info.pszDocString = null; 
     info.pszHelpFile = null; 
     info.pszTitle = "Deployment"; //Assign tab name 
     info.SIZE.cx = this.Size.Width; 
     info.SIZE.cy = this.Size.Height; 
     if (pPageInfo != null && pPageInfo.Length > 0) 
      pPageInfo[0] = info; 
    } 
} 

你注册它像这样:

[MSVSIP.ProvideObject(typeof(DeployPropertyPage), RegisterUsing = RegistrationMethod.CodeBase)] 
+0

我实现了属性页这样,但我不获取标签视图;而是显示一个非模式对话框(如左侧有一棵树的常规Visual Studio选项对话框)。树上有一个节点显示页面的标题...我错过了什么吗? – Matze 2013-12-27 14:46:46

相关问题