WindowConfiguration 介面
WindowConfiguration 物件表示 Visual Studio 環境中所有視窗的配置與組態。
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.dll 中)
語法
'宣告
<GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D")> _
Public Interface WindowConfiguration
[GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D")]
public interface WindowConfiguration
[GuidAttribute(L"41D02413-8A67-4C28-A980-AD7539ED415D")]
public interface class WindowConfiguration
[<GuidAttribute("41D02413-8A67-4C28-A980-AD7539ED415D")>]
type WindowConfiguration = interface end
public interface WindowConfiguration
WindowConfiguration 型別會公開下列成員。
屬性
名稱 | 說明 | |
---|---|---|
Collection | 取得集合,這個集合包含支援這個屬性的物件或這個程式碼建構內所含的物件。 | |
DTE | 取得最上層的擴充性物件。 | |
Name | 設定或取得物件的名稱。 |
回頁首
方法
名稱 | 說明 | |
---|---|---|
Apply | 叫用之前儲存之具名的視窗組態。 | |
Delete | 從集合中移除視窗組態。 | |
Update | 更新集合,如同使用者開啟 [增益集管理員] 對話方塊一般,或者將物件的視窗配置設定為目前視窗的配置。 |
回頁首
備註
您可以將目前 Visual Studio 環境中的視窗配置儲存為具名的視窗組態。 WindowConfiguration 物件表示這項組態,您可在稍後使用 Apply 方法重新呼叫。
範例
Sub WinConfigExample1(ByVal dte As DTE)
' This example lists all currently available named window
' configurations.
' Set references to all necessary objects.
Dim colWinConfig As WindowConfigurations
Dim objWinConfig As WindowConfiguration
colWinConfig = dte.WindowConfigurations
MsgBox("Number of configurations: " & colWinConfig.Count)
' List all saved named window configurations.
FillMsg(colWinConfig)
' Create a new window configuration.
objWinConfig = colWinConfig.Add("NewLayout")
FillMsg(colWinConfig)
' Get rid of the new window configuration.
objWinConfig.Delete()
MsgBox("Number of configurations: " & colWinConfig.Count)
FillMsg(colWinConfig)
End Sub
Sub FillMsg(ByVal colWinConfig As Object)
' Lists all currently available named window configurations.
Dim lCtr As Integer
Dim strMsg As String
For lCtr = 1 To colWinConfig.Count
strMsg = strMsg & "Configuration name " & lCtr & ": " & _
colWinConfig.Item(lCtr).Name & vbCr
Next lCtr
strMsg = "Current Configurations: " & vbCr & strMsg
MsgBox(strMsg)
End Sub
void WinConfigExample1(_DTE dte)
{
// Set references to all necessary objects.
WindowConfigurations colWinConfig;
WindowConfiguration objWinConfig;
colWinConfig = dte.WindowConfigurations;
MessageBox.Show("Number of configurations: " +
colWinConfig.Count);
// List all saved named window configurations.
FillMsg(colWinConfig);
//Create a new window configuration.
objWinConfig = colWinConfig.Add("NewLayout");
FillMsg(colWinConfig);
// Get rid of the new window configuration.
objWinConfig.Delete();
MessageBox.Show("Number of configurations: " + colWinConfig.Count);
FillMsg(colWinConfig);
}
void FillMsg(WindowConfigurations colWinConfig )
{
// Lists all currently available named window configurations.
int lCtr;
string strMsg = null;
for (lCtr = 1; lCtr < colWinConfig.Count + 1; lCtr ++)
{
strMsg = strMsg + "Configuration name " + lCtr + ": " +
colWinConfig.Item(lCtr).Name + "\n";
}
strMsg = "Current Configurations: \n" + strMsg;
MessageBox.Show(strMsg);
}