Public Class Form1 Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load Me.Show() Dim tmpSplitter As Splitter Dim tmpPanel As Panel Dim MainPanel As Panel ' This is main panel ' MainPanel = New Panel With MainPanel .Name = "MainPanel" .Dock = DockStyle.Fill .BackColor = Color.LightGray .BorderStyle = BorderStyle.Fixed3D .Visible = True End With Me.Controls.Add(MainPanel) ' 1: First Top Panel and Splitter ' tmpPanel = New Panel With tmpPanel .Name = "Panel1" .Dock = DockStyle.Top .BackColor = Color.Red .Visible = True End With tmpSplitter = New Splitter With tmpSplitter .Name = "Split1" .Dock = DockStyle.Top .BackColor = Color.Blue .Cursor = Cursors.HSplit End With Me.Controls.Add(tmpSplitter) Me.Controls.Add(tmpPanel) ' 2: Second Panel added to the left side of the main panel ' MainPanel.Dock = DockStyle.Right MainPanel.Size = New Size(MainPanel.Width * 0.5, MainPanel.Height) Dim btn As New Button btn.Size = New Size(10, 50) btn.Location = New Point(MainPanel.Location.X - btn.Width, MainPanel.Location.Y) Me.Controls.Add(btn) tmpPanel = New Panel With tmpPanel .Size = New Size(10, MainPanel.Height) .Location = New Point(MainPanel.Location.X - .Width - 5, MainPanel.Location.Y) .Name = "Panel2" .Dock = DockStyle.Fill .BackColor = Color.Brown End With ' THIS SPLITTER IS NOT IN THE RIGHT PLACE. Must be between brown and gray panel ' tmpSplitter = New Splitter With tmpSplitter .Size = New Size(5, MainPanel.Height) .Location = New Point(MainPanel.Location.X - .Width, MainPanel.Location.Y) .Name = "Split2" .Dock = DockStyle.Right .BackColor = Color.Green .Cursor = Cursors.VSplit End With Me.Controls.Add(tmpSplitter) Me.Controls.Add(tmpPanel) End Sub End Class
Me.Controls.SetChildIndex (tmpSplitter, 0)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)