.NET
  Home arrow .NET arrow Page 6 - The Why and How of the SplitContainer Cont...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
ASP Web Hosting  
ASP.NET Web Hosting 
Dedicated Servers 
Moblin 
JMSL Numerical Library 
Windows Web Hosting
 
IBM® developerWorks 
Sun Developer Network 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
.NET

The Why and How of the SplitContainer Control
By: Jayaram Krishnaswamy
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 13
    2006-11-27

    Table of Contents:
  • The Why and How of the SplitContainer Control
  • The two orientations of SplitContainer Controls
  • Docking and Anchoring of Controls
  • Anchoring to prevent obscuring
  • Hide and reveal panels with nested SplitContainers
  • Events related to the SplitContainer Control

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    The Why and How of the SplitContainer Control - Events related to the SplitContainer Control


    (Page 6 of 6 )

    The object browser shows two events related to the SplitContainer Control. They are SplitterMoving and SplitterMoved.

    The following code snippet shows how you may visualize the two events. For those who are familiar with Visual Basic 6, the vertical and horizontal scroll bars had this feature. The SplitterMoving event captures the dynamic changes while the SplitterMoved event looks at the splitter after it has moved and come to a rest.

    Double click the SplitContainer control onto a new form. Add two text boxes to the form as shown. In the code box you can use the drop-down to get the event codes as shown.

    Public Class Form1
    Private Sub SplitContainer1_SplitterMoved(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.SplitterEventArgs) Handles _
    SplitContainer1.SplitterMoved
    Dim strg As String = ""
    strg = strg + "SplitContainer Splitterwidth is: " & _
    SplitContainer1.SplitterWidth.ToString & vbCrLf
    strg = strg + "SplitterContainer SplitterDistance is: " & _
    SplitContainer1.SplitterDistance.ToString & vbCrLf
    strg = strg + "SplitterContainer Panel1 width is: " & _
    SplitContainer1.Panel1.Width & vbCrLf
    strg = strg + "SplitContainer width: " & _
    SplitContainer1.Width.ToString
    TextBox1.Text = strg
    End Sub
    Private Sub SplitContainer1_SplitterMoving(ByVal sender As Object, _
    ByVal e As System.Windows.Forms.SplitterCancelEventArgs) Handles _
    SplitContainer1.SplitterMoving
    Dim strg As String = ""
    strg = strg + "SplitterContainer Panel1 width is: " & _
    SplitContainer1.Panel1.Width & vbCrLf
    TextBox2.Text = strg
    End Sub
    End Class
    

    When you run the program you can see that data is captured while the SplitContainer is still moving. It is important that the hardware works well so that you can see the effects while moving. To grab the splitter more effectively, the splitter increment was set at 1 and the splitter width was set at 10. The picture shows the form at an intermediate dragged position.

     

    Summary

    The SplitContainer control is a very useful control to rapidly design user interfaces similar to those used in "Explorer" type programs. The VS 2005 IDE has numerous windows with this control, both simple and nested types. Many of the properties can be set in the design and most of the rest can be programmatically controlled. By combining the other ASP.NET 2.0 specific controls it is possible to deliver a rich user experience with a minimum of code.


    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

       · This is a nice control to use in your navigation strategy. Also good for displaying...
       · With the splitter control it was possible to place controls like labels on...
     

    .NET ARTICLES

    - More on Commands, Input and the WPF
    - Grouping and Aggregating When Querying LINQ ...
    - Commands, Input and the WPF
    - Keyboard and Ink Input with WPF
    - Mouse Input and the WPF
    - Input with Windows Presentation Foundation
    - Introducing LINQ with XML and Databases
    - An Introduction to LINQ
    - Querying LINQ to SQL: Basics
    - Completing a Simple Storefront with LINQ
    - Knowing Your Environment: the System.Environ...
    - Creating the Home Page for a Simple Storefro...
    - LINQ Quickly with Language Integrated Queries
    - Introducing LINQ to SQL Designer using Visua...
    - Beginning LINQ to SQL Using Visual Studio 20...





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway