共用方式為


WindowConfiguration Interface

Definition

The WindowConfiguration object represents the layout and configuration of all windows in the Visual Studio environment.

public interface class WindowConfiguration
public interface class WindowConfiguration
__interface WindowConfiguration
[System.Runtime.InteropServices.Guid("41D02413-8A67-4C28-A980-AD7539ED415D")]
[System.Runtime.InteropServices.TypeLibType(4160)]
public interface WindowConfiguration
[System.Runtime.InteropServices.Guid("41D02413-8A67-4C28-A980-AD7539ED415D")]
public interface WindowConfiguration
[<System.Runtime.InteropServices.Guid("41D02413-8A67-4C28-A980-AD7539ED415D")>]
[<System.Runtime.InteropServices.TypeLibType(4160)>]
type WindowConfiguration = interface
[<System.Runtime.InteropServices.Guid("41D02413-8A67-4C28-A980-AD7539ED415D")>]
type WindowConfiguration = interface
Public Interface WindowConfiguration
Attributes

Examples

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);  
}  

Remarks

You can save your current window layout in the Visual Studio environment as a named window configuration. The WindowConfiguration object represents this configuration, which you can later recall by using the Apply method.

Properties

Collection

Gets the collection containing the object supporting this property or contained within this code construct.

DTE

Gets the top-level extensibility object.

Name

Sets or gets the name of the object.

Methods

Apply(Boolean)

Invokes a previously saved named window configuration.

Delete()

Removes the window configuration from the collection.

Update()

Updates the collection of windows or sets the object's window layout to the current window layout.

Applies to