SolutionFolder.Hidden 屬性
設定或取得隱藏的方案屬性。
命名空間: EnvDTE80
組件: EnvDTE80 (在 EnvDTE80.dll 中)
語法
'宣告
Property Hidden As Boolean
Get
Set
bool Hidden { get; set; }
property bool Hidden {
bool get ();
void set (bool value);
}
abstract Hidden : bool with get, set
function get Hidden () : boolean
function set Hidden (value : boolean)
屬性值
型別:System.Boolean
判斷方案總管中是否有隱藏看不見的方案。
範例
這個範例中,會建立新方案資料夾,並從現有檔案中加入專案至此資料夾。 它也會使用 AddSolutionFolder 方法將巢狀的新方案資料夾加入至第一個資料夾,然後會顯示並設定 Hidden 屬性為 false。 在執行這個範例之前,請先在主磁碟機 (在範例中為 "C:") 以外的地方建立一個 "Projects" 資料夾,並在其中建立名為 "ClassLibrary1" 的 Visual C# 類別庫專案。 執行這個增益集之前,請先開啟 Visual Studio 整合式開發環境 (IDE) 中的專案。
如需如何像執行增益集一般,執行這個範例的詳細資訊,請參閱 HOW TO:編譯和執行 Automation 物件模型程式碼範例。
Imports EnvDTE
Imports EnvDTE80
Public Sub OnConnection(ByVal application As Object, _
ByVal connectMode As ext_ConnectMode, ByVal addInInst As Object, _
ByRef custom As Array) Implements IDTExtensibility2.OnConnection
_applicationObject = CType(application, DTE2)
_addInInstance = CType(addInInst, AddIn)
solnFolderHiddenExample(_applicationObject)
End Sub
Sub solnFolderHiddenExample(ByVal dte As DTE2)
' Before running this example, create a "Projects" folder
' off your main drive (C: in this example), and create a C#
' class library project named ClassLibrary1 in that folder.
Dim soln As Solution2 = CType(_applicationObject.Solution _
, Solution2)
Dim prj As Project
Dim SF As SolutionFolder
Try
Dim prjPath As String = _
"C:\Projects\ClassLibrary1\ClassLibrary1\ClassLibrary1.csproj"
' Open a project in the Visual Studio IDE before
' running this add-in.
' Add a solution folder.
prj = soln.AddSolutionFolder("A new soln folder")
SF = CType(prj.Object, SolutionFolder)
' Add a project to the new solution folder.
SF.AddFromFile(prjPath)
MsgBox("Added a new solution folder that contains _
a C# project named ClassLibrary1.")
SF.AddSolutionFolder("New solnFolder2")
MsgBox("Added a new solution folder _
named 'New solnFolder2'.")
MsgBox("The Hidden property value is set to: " _
& SF.Hidden.ToString())
MsgBox("Set the 'Hidden' property to 'False'.")
SF.Hidden = False
Catch ex As System.Exception
MsgBox(ex.ToString)
End Try
End Sub
using EnvDTE;
using EnvDTE80;
using System.Windows.Forms;
public void OnConnection(object application,
ext_ConnectMode connectMode, object addInInst, ref Array custom)
{
_applicationObject = (DTE2)application;
_addInInstance = (AddIn)addInInst;
solnFolderHiddenExample(_applicationObject);
}
public void solnFolderHiddenExample(DTE2 dte)
{
// Before running this example, create a "Projects" folder
// off your main drive (C: in this example), and create a C#
// class library project, named ClassLibrary1 in that folder.
Solution2 soln = (Solution2)_applicationObject.Solution;
Project prj;
SolutionFolder SF;
try
{
String prjPath =
"C:\\Projects\\ClassLibrary1\\ClassLibrary1\\ClassLibrary1.csproj";
// Open a project in Visual Studio IDE before
// running this add-in.
// Add a solution folder.
prj = soln.AddSolutionFolder("A new soln folder");
SF = (SolutionFolder)prj.Object;
// Add a project to the new solution folder.
SF.AddFromFile(prjPath);
MessageBox.Show("Added a new solution folder that
contains a C# project named ClassLibrary1.");
SF.AddSolutionFolder("New solnFolder2");
MessageBox.Show("Added a new solution folder
named 'New solnFolder2'.");
MessageBox.Show("The Hidden property value is set to: "
+ SF.Hidden.ToString());
MessageBox.Show("Set the 'Hidden' property to 'false'.");
SF.Hidden = false;
}
catch(SystemException ex)
{
MessageBox.Show(ex.ToString());
}
}
.NET Framework 安全性
- 完全信任立即呼叫者。這個成員無法供部分信任的程式碼使用。如需詳細資訊,請參閱從部分受信任程式碼使用程式庫。