Representa un control que consta de una barra móvil que divide el área de presentación de un contenedor en dos paneles de tamaño variable.
Espacio de nombres: System.Windows.Forms
Ensamblado: System.Windows.Forms (en system.windows.forms.dll)
Visual Basic (Declaración)
<ComVisibleAttribute(True)> _
<ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)> _
Public Class SplitContainer
Inherits ContainerControl
Dim instance As SplitContainer
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)]
public class SplitContainer : ContainerControl
[ComVisibleAttribute(true)]
[ClassInterfaceAttribute(ClassInterfaceType::AutoDispatch)]
public ref class SplitContainer : public ContainerControl
/** @attribute ComVisibleAttribute(true) */
/** @attribute ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch) */
public class SplitContainer extends ContainerControl
ComVisibleAttribute(true)
ClassInterfaceAttribute(ClassInterfaceType.AutoDispatch)
public class SplitContainer extends ContainerControl
Puede agregar controles a los dos paneles de tamaño variable, así como otros controles SplitContainer a paneles SplitContainer existentes para crear muchas áreas de presentación de tamaño variable.
Utilice el control SplitContainer para dividir el área de presentación de un contenedor (como un formulario Form) y permitir al usuario cambiar el tamaño de los controles agregados a los paneles SplitContainer. Cuando el usuario desplaza el puntero del mouse (ratón) sobre el divisor, el cursor cambia para indicar que se puede cambiar el tamaño de los controles incluidos en el control SplitContainer.
Nota: |
|---|
| Las versiones anteriores de .NET Framework sólo admiten el control Splitter. |
SplitContainer también facilita la colocación del control en tiempo de diseño. Por ejemplo, para crear una ventana similar a la del Explorador de Windows, agregue un control SplitContainer a un formulario Form y establezca su propiedad Dock en DockStyle.Fill. Agregue un control TreeView al formulario Form y establezca también su propiedad Dock en DockStyle.Fill. Para terminar el diseño, agregue un control ListView y establezca su propiedad Dock en DockStyle.Fill para que el control ListView ocupe el resto del espacio del formulario Form. En tiempo de ejecución, el usuario puede cambiar el ancho de ambos controles utilizando el divisor. Utilice la propiedad FixedPanel para especificar que no se debe cambiar el tamaño de un control junto con el formulario Form o junto con otro contenedor.
Utilice SplitterDistance para especificar dónde se inicia el divisor en el formulario. Utilice SplitterIncrement para especificar cuántos píxeles debe moverse cada vez el divisor. El valor predeterminado de SplitterIncrement es un píxel.
Utilice Panel1MinSize y Panel2MinSize para especificar la cercanía a la que se puede colocar la barra divisora respecto al borde exterior de un panel SplitContainer. El tamaño mínimo predeterminado de un panel es de 25 píxeles.
Utilice la propiedad Orientation para especificar la orientación horizontal. La orientación predeterminada de SplitContainer es vertical.
Utilice la propiedad BorderStyle para especificar el estilo del borde del divisor SplitContainer y coordinar su estilo de borde con el estilo de borde de los controles agregados a SplitContainer.
El ejemplo de código siguiente muestra un control SplitContainer vertical y horizontal. El divisor vertical se desplaza en incrementos de 10 píxeles. El panel izquierdo del contenedor SplitContainer vertical contiene un control TreeView, mientras que su panel derecho contiene un contenedor SplitContainer horizontal. Ambos paneles del divisor SplitContainer horizontal contienen controles ListView y el panel superior están definido como FixedPanel, de manera que no cambie de tamaño al cambiar el tamaño del contenedor. Al mover el divisor vertical, se produce el evento SplitterMoving, que en este ejemplo corresponde a un cambio de estilo del cursor. El evento SplitterMoved se produce al dejar de mover el divisor. Esto se expresa, en este ejemplo, devolviendo el estilo del cursor al valor predeterminado.
' Compile this example using the following command line:
' vbc basicsplitcontainer.vb /r:System.Drawing.dll /r:System.Windows.Forms.dll /r:System.dll /r:System.Data.dll
Imports System
Imports System.Drawing
Imports System.Collections
Imports System.ComponentModel
Imports System.Windows.Forms
Imports System.Data
Imports Microsoft.VisualBasic
Public Class Form1
Inherits System.Windows.Forms.Form
Private WithEvents splitContainer1 As System.Windows.Forms.SplitContainer
Private treeView1 As System.Windows.Forms.TreeView
Private splitContainer2 As System.Windows.Forms.SplitContainer
Private listView2 As System.Windows.Forms.ListView
Private listView1 As System.Windows.Forms.ListView
Public Sub New()
InitializeComponent()
End Sub 'New
Private Sub InitializeComponent()
splitContainer1 = New System.Windows.Forms.SplitContainer()
treeView1 = New System.Windows.Forms.TreeView()
splitContainer2 = New System.Windows.Forms.SplitContainer()
listView1 = New System.Windows.Forms.ListView()
listView2 = New System.Windows.Forms.ListView()
splitContainer1.SuspendLayout()
splitContainer2.SuspendLayout()
SuspendLayout()
' Basic SplitContainer properties.
' This is a vertical splitter that moves in 10-pixel increments.
' This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill
splitContainer1.ForeColor = System.Drawing.SystemColors.Control
splitContainer1.Location = New System.Drawing.Point(0, 0)
splitContainer1.Name = "splitContainer1"
' You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1.Panel1MinSize = 30
' You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1.Panel2MinSize = 20
splitContainer1.Size = New System.Drawing.Size(292, 273)
splitContainer1.SplitterDistance = 79
' This splitter moves in 10-pixel increments.
splitContainer1.SplitterIncrement = 10
splitContainer1.SplitterWidth = 6
' splitContainer1 is the first control in the tab order.
splitContainer1.TabIndex = 0
splitContainer1.Text = "splitContainer1"
' Add a TreeView control to the left panel.
splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control
' Add a TreeView control to Panel1.
splitContainer1.Panel1.Controls.Add(treeView1)
splitContainer1.Panel1.Name = "splitterPanel1"
' Controls placed on Panel1 support right-to-left fonts.
splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes
' Add a SplitContainer to the right panel.
splitContainer1.Panel2.Controls.Add(splitContainer2)
splitContainer1.Panel2.Name = "splitterPanel2"
' This TreeView control is in Panel1 of splitContainer1.
treeView1.Dock = System.Windows.Forms.DockStyle.Fill
treeView1.ForeColor = System.Drawing.SystemColors.InfoText
treeView1.ImageIndex = - 1
treeView1.Location = New System.Drawing.Point(0, 0)
treeView1.Name = "treeView1"
treeView1.SelectedImageIndex = - 1
treeView1.Size = New System.Drawing.Size(79, 273)
' treeView1 is the second control in the tab order.
treeView1.TabIndex = 1
' Basic SplitContainer properties.
' This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed.
splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill
' The top panel remains the same size when the form is resized.
splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1
splitContainer2.Location = New System.Drawing.Point(0, 0)
splitContainer2.Name = "splitContainer2"
' Create the horizontal splitter.
splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal
splitContainer2.Size = New System.Drawing.Size(207, 273)
splitContainer2.SplitterDistance = 125
splitContainer2.SplitterWidth = 6
' splitContainer2 is the third control in the tab order.
splitContainer2.TabIndex = 2
splitContainer2.Text = "splitContainer2"
' This splitter panel contains the top ListView control.
splitContainer2.Panel1.Controls.Add(listView1)
splitContainer2.Panel1.Name = "splitterPanel3"
' This splitter panel contains the bottom ListView control.
splitContainer2.Panel2.Controls.Add(listView2)
splitContainer2.Panel2.Name = "splitterPanel4"
' This ListView control is in the top panel of splitContainer2.
listView1.Dock = System.Windows.Forms.DockStyle.Fill
listView1.Location = New System.Drawing.Point(0, 0)
listView1.Name = "listView1"
listView1.Size = New System.Drawing.Size(207, 125)
' listView1 is the fourth control in the tab order.
listView1.TabIndex = 3
' This ListView control is in the bottom panel of splitContainer2.
listView2.Dock = System.Windows.Forms.DockStyle.Fill
listView2.Location = New System.Drawing.Point(0, 0)
listView2.Name = "listView2"
listView2.Size = New System.Drawing.Size(207, 142)
' listView2 is the fifth control in the tab order.
listView2.TabIndex = 4
' These are basic properties of the form.
ClientSize = New System.Drawing.Size(292, 273)
Controls.Add(splitContainer1)
Name = "Form1"
Text = "Form1"
splitContainer1.ResumeLayout(False)
splitContainer2.ResumeLayout(False)
ResumeLayout(False)
End Sub 'InitializeComponent
<STAThread()> _
Shared Sub Main()
Application.Run(New Form1())
End Sub 'Main
Private Sub splitContainer1_SplitterMoving(sender As System.Object, e As System.Windows.Forms.SplitterCancelEventArgs) Handles splitContainer1.SplitterMoving
' As the splitter moves, change the cursor type.
Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert
End Sub 'splitContainer1_SplitterMoving
Private Sub splitContainer1_SplitterMoved(sender As System.Object, e As System.Windows.Forms.SplitterEventArgs) Handles splitContainer1.SplitterMoved
' When the splitter stops moving, change the cursor back to the default.
Cursor.Current = System.Windows.Forms.Cursors.Default
End Sub 'splitContainer1_SplitterMoved
End Class 'Form1
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.ListView listView2;
private System.Windows.Forms.ListView listView1;
public Form1()
{
InitializeComponent();
}
private void InitializeComponent()
{
splitContainer1 = new System.Windows.Forms.SplitContainer();
treeView1 = new System.Windows.Forms.TreeView();
splitContainer2 = new System.Windows.Forms.SplitContainer();
listView1 = new System.Windows.Forms.ListView();
listView2 = new System.Windows.Forms.ListView();
splitContainer1.SuspendLayout();
splitContainer2.SuspendLayout();
SuspendLayout();
// Basic SplitContainer properties.
// This is a vertical splitter that moves in 10-pixel increments.
// This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
splitContainer1.ForeColor = System.Drawing.SystemColors.Control;
splitContainer1.Location = new System.Drawing.Point(0, 0);
splitContainer1.Name = "splitContainer1";
// You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1.Panel1MinSize = 30;
// You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1.Panel2MinSize = 20;
splitContainer1.Size = new System.Drawing.Size(292, 273);
splitContainer1.SplitterDistance = 79;
// This splitter moves in 10-pixel increments.
splitContainer1.SplitterIncrement = 10;
splitContainer1.SplitterWidth = 6;
// splitContainer1 is the first control in the tab order.
splitContainer1.TabIndex = 0;
splitContainer1.Text = "splitContainer1";
// When the splitter moves, the cursor changes shape.
splitContainer1.SplitterMoved += new System.Windows.Forms.SplitterEventHandler(splitContainer1_SplitterMoved);
splitContainer1.SplitterMoving += new System.Windows.Forms.SplitterCancelEventHandler(splitContainer1_SplitterMoving);
// Add a TreeView control to the left panel.
splitContainer1.Panel1.BackColor = System.Drawing.SystemColors.Control;
// Add a TreeView control to Panel1.
splitContainer1.Panel1.Controls.Add(treeView1);
splitContainer1.Panel1.Name = "splitterPanel1";
// Controls placed on Panel1 support right-to-left fonts.
splitContainer1.Panel1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
// Add a SplitContainer to the right panel.
splitContainer1.Panel2.Controls.Add(splitContainer2);
splitContainer1.Panel2.Name = "splitterPanel2";
// This TreeView control is in Panel1 of splitContainer1.
treeView1.Dock = System.Windows.Forms.DockStyle.Fill;
treeView1.ForeColor = System.Drawing.SystemColors.InfoText;
treeView1.ImageIndex = -1;
treeView1.Location = new System.Drawing.Point(0, 0);
treeView1.Name = "treeView1";
treeView1.SelectedImageIndex = -1;
treeView1.Size = new System.Drawing.Size(79, 273);
// treeView1 is the second control in the tab order.
treeView1.TabIndex = 1;
// Basic SplitContainer properties.
// This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed.
splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill;
// The top panel remains the same size when the form is resized.
splitContainer2.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
splitContainer2.Location = new System.Drawing.Point(0, 0);
splitContainer2.Name = "splitContainer2";
// Create the horizontal splitter.
splitContainer2.Orientation = System.Windows.Forms.Orientation.Horizontal;
splitContainer2.Size = new System.Drawing.Size(207, 273);
splitContainer2.SplitterDistance = 125;
splitContainer2.SplitterWidth = 6;
// splitContainer2 is the third control in the tab order.
splitContainer2.TabIndex = 2;
splitContainer2.Text = "splitContainer2";
// This splitter panel contains the top ListView control.
splitContainer2.Panel1.Controls.Add(listView1);
splitContainer2.Panel1.Name = "splitterPanel3";
// This splitter panel contains the bottom ListView control.
splitContainer2.Panel2.Controls.Add(listView2);
splitContainer2.Panel2.Name = "splitterPanel4";
// This ListView control is in the top panel of splitContainer2.
listView1.Dock = System.Windows.Forms.DockStyle.Fill;
listView1.Location = new System.Drawing.Point(0, 0);
listView1.Name = "listView1";
listView1.Size = new System.Drawing.Size(207, 125);
// listView1 is the fourth control in the tab order.
listView1.TabIndex = 3;
// This ListView control is in the bottom panel of splitContainer2.
listView2.Dock = System.Windows.Forms.DockStyle.Fill;
listView2.Location = new System.Drawing.Point(0, 0);
listView2.Name = "listView2";
listView2.Size = new System.Drawing.Size(207, 142);
// listView2 is the fifth control in the tab order.
listView2.TabIndex = 4;
// These are basic properties of the form.
ClientSize = new System.Drawing.Size(292, 273);
Controls.Add(splitContainer1);
Name = "Form1";
Text = "Form1";
splitContainer1.ResumeLayout(false);
splitContainer2.ResumeLayout(false);
ResumeLayout(false);
}
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void splitContainer1_SplitterMoving(System.Object sender, System.Windows.Forms.SplitterCancelEventArgs e)
{
// As the splitter moves, change the cursor type.
Cursor.Current = System.Windows.Forms.Cursors.NoMoveVert;
}
private void splitContainer1_SplitterMoved(System.Object sender, System.Windows.Forms.SplitterEventArgs e)
{
// When the splitter stops moving, change the cursor back to the default.
Cursor.Current=System.Windows.Forms.Cursors.Default;
}
}
#using <System.Data.dll>
#using <System.dll>
#using <System.Windows.Forms.dll>
#using <System.Drawing.dll>
using namespace System;
using namespace System::Drawing;
using namespace System::Collections;
using namespace System::ComponentModel;
using namespace System::Windows::Forms;
using namespace System::Data;
public ref class Form1: public System::Windows::Forms::Form
{
private:
System::Windows::Forms::SplitContainer^ splitContainer1;
System::Windows::Forms::TreeView^ treeView1;
System::Windows::Forms::SplitContainer^ splitContainer2;
System::Windows::Forms::ListView^ listView2;
System::Windows::Forms::ListView^ listView1;
public:
Form1()
{
InitializeComponent();
}
private:
void InitializeComponent()
{
splitContainer1 = gcnew System::Windows::Forms::SplitContainer;
treeView1 = gcnew System::Windows::Forms::TreeView;
splitContainer2 = gcnew System::Windows::Forms::SplitContainer;
listView1 = gcnew System::Windows::Forms::ListView;
listView2 = gcnew System::Windows::Forms::ListView;
splitContainer1->SuspendLayout();
splitContainer2->SuspendLayout();
SuspendLayout();
// Basic SplitContainer properties.
// This is a vertical splitter that moves in 10-pixel increments.
// This splitter needs no explicit Orientation property because Vertical is the default.
splitContainer1->Dock = System::Windows::Forms::DockStyle::Fill;
splitContainer1->ForeColor = System::Drawing::SystemColors::Control;
splitContainer1->Location = System::Drawing::Point( 0, 0 );
splitContainer1->Name = "splitContainer1";
// You can drag the splitter no nearer than 30 pixels from the left edge of the container.
splitContainer1->Panel1MinSize = 30;
// You can drag the splitter no nearer than 20 pixels from the right edge of the container.
splitContainer1->Panel2MinSize = 20;
splitContainer1->Size = System::Drawing::Size( 292, 273 );
splitContainer1->SplitterDistance = 79;
// This splitter moves in 10-pixel increments.
splitContainer1->SplitterIncrement = 10;
splitContainer1->SplitterWidth = 6;
// splitContainer1 is the first control in the tab order.
splitContainer1->TabIndex = 0;
splitContainer1->Text = "splitContainer1";
// When the splitter moves, the cursor changes shape.
splitContainer1->SplitterMoved += gcnew System::Windows::Forms::SplitterEventHandler( this, &Form1::splitContainer1_SplitterMoved );
splitContainer1->SplitterMoving += gcnew System::Windows::Forms::SplitterCancelEventHandler( this, &Form1::splitContainer1_SplitterMoving );
// Add a TreeView control to the left panel.
splitContainer1->Panel1->BackColor = System::Drawing::SystemColors::Control;
// Add a TreeView control to Panel1.
splitContainer1->Panel1->Controls->Add( treeView1 );
splitContainer1->Panel1->Name = "splitterPanel1";
// Controls placed on Panel1 support right-to-left fonts.
splitContainer1->Panel1->RightToLeft = System::Windows::Forms::RightToLeft::Yes;
// Add a SplitContainer to the right panel.
splitContainer1->Panel2->Controls->Add( splitContainer2 );
splitContainer1->Panel2->Name = "splitterPanel2";
// This TreeView control is in Panel1 of splitContainer1.
treeView1->Dock = System::Windows::Forms::DockStyle::Fill;
treeView1->ForeColor = System::Drawing::SystemColors::InfoText;
treeView1->ImageIndex = -1;
treeView1->Location = System::Drawing::Point( 0, 0 );
treeView1->Name = "treeView1";
treeView1->SelectedImageIndex = -1;
treeView1->Size = System::Drawing::Size( 79, 273 );
// treeView1 is the second control in the tab order.
treeView1->TabIndex = 1;
// Basic SplitContainer properties.
// This is a horizontal splitter whose top and bottom panels are ListView controls. The top panel is fixed.
splitContainer2->Dock = System::Windows::Forms::DockStyle::Fill;
// The top panel remains the same size when the form is resized.
splitContainer2->FixedPanel = System::Windows::Forms::FixedPanel::Panel1;
splitContainer2->Location = System::Drawing::Point( 0, 0 );
splitContainer2->Name = "splitContainer2";
// Create the horizontal splitter.
splitContainer2->Orientation = System::Windows::Forms::Orientation::Horizontal;
splitContainer2->Size = System::Drawing::Size( 207, 273 );
splitContainer2->SplitterDistance = 125;
splitContainer2->SplitterWidth = 6;
// splitContainer2 is the third control in the tab order.
splitContainer2->TabIndex = 2;
splitContainer2->Text = "splitContainer2";
// This splitter panel contains the top ListView control.
splitContainer2->Panel1->Controls->Add( listView1 );
splitContainer2->Panel1->Name = "splitterPanel3";
// This splitter panel contains the bottom ListView control.
splitContainer2->Panel2->Controls->Add( listView2 );
splitContainer2->Panel2->Name = "splitterPanel4";
// This ListView control is in the top panel of splitContainer2.
listView1->Dock = System::Windows::Forms::DockStyle::Fill;
listView1->Location = System::Drawing::Point( 0, 0 );
listView1->Name = "listView1";
listView1->Size = System::Drawing::Size( 207, 125 );
// listView1 is the fourth control in the tab order.
listView1->TabIndex = 3;
// This ListView control is in the bottom panel of splitContainer2.
listView2->Dock = System::Windows::Forms::DockStyle::Fill;
listView2->Location = System::Drawing::Point( 0, 0 );
listView2->Name = "listView2";
listView2->Size = System::Drawing::Size( 207, 142 );
// listView2 is the fifth control in the tab order.
listView2->TabIndex = 4;
// These are basic properties of the form.
ClientSize = System::Drawing::Size( 292, 273 );
Controls->Add( splitContainer1 );
Name = "Form1";
Text = "Form1";
splitContainer1->ResumeLayout( false );
splitContainer2->ResumeLayout( false );
ResumeLayout( false );
}
void splitContainer1_SplitterMoving( System::Object^ /*sender*/, System::Windows::Forms::SplitterCancelEventArgs ^ /*e*/ )
{
// As the splitter moves, change the cursor type.
::Cursor::Current = System::Windows::Forms::Cursors::NoMoveVert;
}
void splitContainer1_SplitterMoved( System::Object^ /*sender*/, System::Windows::Forms::SplitterEventArgs^ /*e*/ )
{
// When the splitter stops moving, change the cursor back to the default.
::Cursor::Current = System::Windows::Forms::Cursors::Default;
}
};
[STAThread]
int main()
{
Application::Run( gcnew Form1 );
}
import System.*;
import System.Drawing.*;
import System.Collections.*;
import System.ComponentModel.*;
import System.Windows.Forms.*;
import System.Data.*;
public class Form1 extends System.Windows.Forms.Form
{
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.TreeView treeView1;
private System.Windows.Forms.SplitContainer splitContainer2;
private System.Windows.Forms.ListView listView2;
private System.Windows.Forms.ListView listView1;
public Form1()
{
InitializeComponent();
} //Form1
private void InitializeComponent()
{
splitContainer1 = new System.Windows.Forms.SplitContainer();
treeView1 = new System.Windows.Forms.TreeView();
splitContainer2 = new System.Windows.Forms.SplitContainer();
listView1 = new System.Windows.Forms.ListView();
listView2 = new System.Windows.Forms.ListView();
splitContainer1.SuspendLayout();
splitContainer2.SuspendLayout();
SuspendLayout();
// Basic SplitContainer properties.
// This is a vertical splitter that moves in 10-pixel increments.
// This splitter needs no explicit Orientation property because
// Vertical is the default.
splitContainer1.set_Dock(System.Windows.Forms.DockStyle.Fill);
splitContainer1.set_ForeColor(System.Drawing.SystemColors.get_Control());
splitContainer1.set_Location(new System.Drawing.Point(0, 0));
splitContainer1.set_Name("splitContainer1");
// You can drag the splitter no nearer than 30 pixels from the
// left edge of the container.
splitContainer1.set_Panel1MinSize(30);
// You can drag the splitter no nearer than 20 pixels from the
// right edge of the container.
splitContainer1.set_Panel2MinSize(20);
splitContainer1.set_Size(new System.Drawing.Size(292, 273));
splitContainer1.set_SplitterDistance(79);
// This splitter moves in 10-pixel increments.
splitContainer1.set_SplitterIncrement(10);
splitContainer1.set_SplitterWidth(6);
// splitContainer1 is the first control in the tab order.
splitContainer1.set_TabIndex(0);
splitContainer1.set_Text("splitContainer1");
// When the splitter moves, the cursor changes shape.
splitContainer1.add_SplitterMoved(new System.Windows.Forms.
SplitterEventHandler(splitContainer1_SplitterMoved));
splitContainer1.add_SplitterMoving(new System.Windows.Forms.
SplitterCancelEventHandler(splitContainer1_SplitterMoving));
// Add a TreeView control to the left panel.
splitContainer1.get_Panel1().set_BackColor(System.Drawing.SystemColors.
get_Control());
// Add a TreeView control to Panel1.
splitContainer1.get_Panel1().get_Controls().Add(treeView1);
splitContainer1.get_Panel1().set_Name("splitterPanel1");
// Controls placed on Panel1 support right-to-left fonts.
splitContainer1.get_Panel1().set_RightToLeft(System.Windows.Forms.
RightToLeft.Yes);
// Add a SplitContainer to the right panel.
splitContainer1.get_Panel2().get_Controls().Add(splitContainer2);
splitContainer1.get_Panel2().set_Name("splitterPanel2");
// This TreeView control is in Panel1 of splitContainer1.
treeView1.set_Dock(System.Windows.Forms.DockStyle.Fill);
treeView1.set_ForeColor(System.Drawing.SystemColors.
get_InfoText());
treeView1.set_ImageIndex(-1);
treeView1.set_Location(new System.Drawing.Point(0, 0));
treeView1.set_Name("treeView1");
treeView1.set_SelectedImageIndex(-1);
treeView1.set_Size(new System.Drawing.Size(79, 273));
// treeView1 is the second control in the tab order.
treeView1.set_TabIndex(1);
// Basic SplitContainer properties.
// This is a horizontal splitter whose top and bottom panels are
// ListView controls. The top panel is fixed.
splitContainer2.set_Dock(System.Windows.Forms.DockStyle.Fill);
// The top panel remains the same size when the form is resized.
splitContainer2.set_FixedPanel(System.Windows.Forms.
FixedPanel.Panel1);
splitContainer2.set_Location(new System.Drawing.Point(0, 0));
splitContainer2.set_Name("splitContainer2");
// Create the horizontal splitter.
splitContainer2.set_Orientation(System.Windows.Forms.
Orientation.Horizontal);
splitContainer2.set_Size(new System.Drawing.Size(207, 273));
splitContainer2.set_SplitterDistance(125);
splitContainer2.set_SplitterWidth(6);
// splitContainer2 is the third control in the tab order.
splitContainer2.set_TabIndex(2);
splitContainer2.set_Text("splitContainer2");
// This splitter panel contains the top ListView control.
splitContainer2.get_Panel1().get_Controls().Add(listView1);
splitContainer2.get_Panel1().set_Name("splitterPanel3");
// This splitter panel contains the bottom ListView control.
splitContainer2.get_Panel2().get_Controls().Add(listView2);
splitContainer2.get_Panel2().set_Name("splitterPanel4");
// This ListView control is in the top panel of splitContainer2.
listView1.set_Dock(System.Windows.Forms.DockStyle.Fill);
listView1.set_Location(new System.Drawing.Point(0, 0));
listView1.set_Name("listView1");
listView1.set_Size(new System.Drawing.Size(207, 125));
// listView1 is the fourth control in the tab order.
listView1.set_TabIndex(3);
// This ListView control is in the bottom panel of splitContainer2.
listView2.set_Dock(System.Windows.Forms.DockStyle.Fill);
listView2.set_Location(new System.Drawing.Point(0, 0));
listView2.set_Name("listView2");
listView2.set_Size(new System.Drawing.Size(207, 142));
// listView2 is the fifth control in the tab order.
listView2.set_TabIndex(4);
// These are basic properties of the form.
set_ClientSize(new System.Drawing.Size(292, 273));
get_Controls().Add(splitContainer1);
set_Name("Form1");
set_Text("Form1");
splitContainer1.ResumeLayout(false);
splitContainer2.ResumeLayout(false);
ResumeLayout(false);
} //InitializeComponent
/** @attribute STAThread()
*/
public static void main(String[] args)
{
Application.Run(new Form1());
} //main
private void splitContainer1_SplitterMoving(Object sender,
System.Windows.Forms.SplitterCancelEventArgs e)
{
// As the splitter moves, change the cursor type.
get_Cursor().set_Current(System.Windows.Forms.Cursors.
get_NoMoveVert());
} //splitContainer1_SplitterMoving
private void splitContainer1_SplitterMoved(Object sender,
System.Windows.Forms.SplitterEventArgs e)
{
// When the splitter stops moving, change the cursor
// back to the default.
get_Cursor().set_Current(System.Windows.Forms.Cursors.
get_Default());
} //splitContainer1_SplitterMoved
} //Form1
System.Object
System.MarshalByRefObject
System.ComponentModel.Component
System.Windows.Forms.Control
System.Windows.Forms.ScrollableControl
System.Windows.Forms.ContainerControl
System.Windows.Forms.SplitContainer
Seguridad para subprocesos
Los miembros estáticos públicos (Shared en Visual Basic) de este tipo son seguros para la ejecución de subprocesos. No se garantiza que los miembros de instancias sean seguros para la ejecución de subprocesos.
Windows 98, Windows 2000 Service Pack 4, Windows CE, Windows Millennium, Windows Mobile para Pocket PC, Windows Mobile para Smartphone, Windows Server 2003, Windows XP Media Center, Windows XP Professional x64, Windows XP SP2, Windows XP Starter
Microsoft .NET Framework 3.0 es compatible con Windows Vista, Microsoft Windows XP SP2 y Windows Server 2003 SP1.
.NET Framework
Compatible con: 3.0, 2.0