PHP User Warning: fetch_template() calls should be replaced by the vB_Template class. Template name: bbcode_highlight in ..../includes/functions.php on line 4197
Splitcontainer 3 panels-VBForums
Results 1 to 7 of 7

Thread: Splitcontainer 3 panels

  1. #1

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    51

    Splitcontainer 3 panels

    Hi I am trying to make a project in vb.net with splitcontainer and 3 panels
    as seen on attached image, can anyone help me and upload an project with this view?

    Name:  SplitContainer.png
Views: 3306
Size:  6.5 KB

  2. #2
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,741

    Re: Splitcontainer 3 panels

    How about, instead of our doing the work for you, we tell you how to do it and then you do it? A SplitContainer contains two panels. That's it, that's all. If you want three panels then you need two SplitContainers. In your case, you'd first add one with the Orientation set to Horizontal and then you'd add a second to the upper panel of the first and set its Orientation to Vertical. You can basically see that from your own screen shot. The top two panels are named Panel1 and Panel2 because they are two panels of one SplitContaner. The bottom panel is Panel2 of the other SplitContainer and you can't see the corresponding Panel1 because it contains the other control.

  3. #3

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    51

    Re: Splitcontainer 3 panels

    Thank you for very good detail and it was easy to insert but after inserting those SplitContainers and when I run the the project they are hardly visible on screen, how can I make the splitters 3d look?

  4. #4
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,741

    Re: Splitcontainer 3 panels

    That's the way Windows looks these days: flat. The image you attached earlier is either from an older version of Windows or from an application or system with visual styles turned off. I'd say that your simplest option to get a 3D appearance in your app on recent versions of Windows would be to add a Panel control into each of the three visible SplitterPanels, set their Dock properties to Fill and their BorderStyle properties to Fixed3D.

  5. #5

    Thread Starter
    Member
    Join Date
    May 2004
    Posts
    51

    Re: Splitcontainer 3 panels

    When I run project now the vertcal splitter is always higlighted, how can I unfocus it?

    Then hopefully last question is, when resize the project as maximize or drag edges, how can I control the size for each panel?

    I really appreciate your help and its very easy to follow you along
    Last edited by iscode; Dec 13th, 2016 at 09:44 PM.

  6. #6
    .NUT jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    104,741

    Re: Splitcontainer 3 panels

    When you open a form, the first control in the Tab order will receive focus. If the Horizontal SplitContainer is the only control that you've added to the form directly then it must be the first in the Tab order. In order to focus a different control, you must wait until the form has been displayed and then do it manually, which means handling the form's Shown event (NOT the Load event) and, in the event handler, calling the Select method (NOT the Focus method) of the control you want to be focused.

  7. #7
    PowerPoster
    Join Date
    Oct 2010
    Posts
    2,141

    Re: Splitcontainer 3 panels

    Quote Originally Posted by iscode View Post
    ...how can I make the splitters 3d look?
    Have you set the SplitContainer.BorderStyle property?

    If that is not a desirable effect, on Win 10 (possibly Win 8.X as well) you can get the older look by setting the form's region property.

    VB.Net Code:
    1. Public Class Form1
    2.     Protected Overrides Sub OnLoad(e As EventArgs)
    3.         MyBase.OnLoad(e)
    4.         SplitContainer1.BorderStyle = BorderStyle.Fixed3D
    5.         If Me.Size = Me.DefaultSize Then SetFormRegion()
    6.     End Sub
    7.  
    8.     Protected Overrides Sub OnResize(e As EventArgs)
    9.         MyBase.OnResize(e)
    10.         SetFormRegion()
    11.     End Sub
    12.  
    13.     Private Sub SetFormRegion()
    14.         Using rgn As Region = Me.Region
    15.             Me.Region = New Region(New Rectangle(0, 0, Me.Width, Me.Height))
    16.         End Using
    17.     End Sub
    18.  
    19.     Private Sub Form1_Disposed(sender As Object, e As EventArgs) Handles Me.Disposed
    20.         If Me.Region IsNot Nothing Then Me.Region.Dispose()
    21.     End Sub
    22. End Class

    Edit: I forgot to mention that using this technique plays a bit of havoc with the clicking of the minimize/restore buttons. Double-clicking the title bar works fine as well as using the system menu.
    Last edited by TnTinMN; Dec 13th, 2016 at 11:44 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Featured


Click Here to Expand Forum to Full Width