WindowConfigurations 介面
WindowConfigurations 集合包含所有針對環境建立的具名視窗組態。
命名空間: EnvDTE
組件: EnvDTE (在 EnvDTE.dll 中)
語法
'宣告
<GuidAttribute("E577442A-98E1-46C5-BD2E-D25807EC81CE")> _
Public Interface WindowConfigurations _
Inherits IEnumerable
[GuidAttribute("E577442A-98E1-46C5-BD2E-D25807EC81CE")]
public interface WindowConfigurations : IEnumerable
[GuidAttribute(L"E577442A-98E1-46C5-BD2E-D25807EC81CE")]
public interface class WindowConfigurations : IEnumerable
[<GuidAttribute("E577442A-98E1-46C5-BD2E-D25807EC81CE")>]
type WindowConfigurations =
interface
interface IEnumerable
end
public interface WindowConfigurations extends IEnumerable
WindowConfigurations 類型會公開下列成員。
屬性
名稱 | 描述 | |
---|---|---|
ActiveConfigurationName | 取得目前使用中的視窗組態名稱。 | |
Count | 取得值,指出集合中物件的數目。 | |
DTE | 取得最上層的擴充性物件。 | |
Parent | 取得 WindowConfigurations 集合的直接上層父物件。 |
回頁首
方法
名稱 | 描述 | |
---|---|---|
Add | 根據視窗目前的排列建立新的具名視窗組態、將它加入 WindowConfigurations 集合,並保留以供日後重新叫用。 | |
GetEnumerator | 取得集合中項目的列舉型別。 | |
Item | 傳回 WindowConfigurations 集合的索引成員。 |
回頁首
備註
您可以將目前 Visual Studio 環境中的視窗配置儲存為具名的視窗組態。 WindowConfigurations 集合包含所有這類組態。
範例
Sub WinConfigurationsExample(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);
}