Quick Search for:  in language:    
vertical,horizontal,splitter,bars,your,applic
   Code/Articles » |  Newest/Best » |  Community » |  Jobs » |  Other » |  Goto » | 
CategoriesSearch Newest CodeCoding ContestCode of the DayAsk A ProJobsUpload
Visual Basic Stats

 Code: 3,014,970. lines
 Jobs: 119. postings

 How to support the site

 
Sponsored by:

 

You are in:

 
Login



Latest Code Ticker for Visual Basic.
DBTool
By Make Strömberg on 7/2


Click here to see a screenshot of this code!MSChart Simple Example
By Sebastian Pereira on 7/2

(Screen Shot)

CString v1.5
By Ultimatum on 7/2


Tablature Pro
By Michael McMullen on 7/2


Click here to see a screenshot of this code!MSN Password Decryptor
By Muhammad Sufyan Ansari on 7/2

(Screen Shot)

Mp3 Paker
By Michael McMullen on 7/2


Suppress Run Time Script Errors
By Nuclear_1000G on 7/2


Click here to see a screenshot of this code!List Maker
By KBM-00 on 7/1

(Screen Shot)

Web Update Checker
By knormalnight on 7/1


Click here to put this ticker on your site!


Add this ticker to your desktop!


Daily Code Email
To join the 'Code of the Day' Mailing List click here!





Affiliate Sites



 
 
   

Add Splitter Bars to your app *Revised*

Print
Email
 

Submitted on: 12/24/1999
By: Eugene 
Level: Intermediate
User Rating: By 9 Users
Compatibility:VB 5.0, VB 6.0

Users have accessed this code 9711 times.
 
 
     Add vertical and horizontal splitter bars to your application. This code creates a form with three panes, and two splitter bars. I originally found the code in Planet Source Code last year, but found a couple of bugs, so I rebuilt it from scratch, and added the horizontal splitter. There are no DLL's or references to worry about, very easy to use.
 
code:
Can't Copy and Paste this?
Click here for a copy-and-paste friendly version of this code!
 
Terms of Agreement:   
By using this code, you agree to the following terms...   
1) You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.   
2) You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
3) You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
4) You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.

'**************************************
' Name: Add Splitter Bars to your app *R
'     evised*
' Description:Add vertical and horizonta
'     l splitter bars to your application. Thi
'     s 
code creates a form With three panes, and two splitter bars. I originally 
found the code In Planet Source Code last year, but found a couple of 
bugs, so I rebuilt it from scratch, and added the horizontal splitter. 
There are no DLL's or references To worry about, very easy to use.
' By: Eugene
'
' Inputs:It is easy to integrate into yo
'     ur applications. You simply paste whatev
'     er 
objects that you want To use into one of the three picture boxes used as 
frames. Then In the _Resize Event of each, change the .Move statement To 
your object (or control).
'
' Assumes:Copy the code and paste it int
'     o a text editor (like notepad). Save the
'     file 
as Form1.frm. You can always change it later.
'
'This code is copyrighted and has' limited warranties.Please see http://w
'     ww.Planet-Source-Code.com/vb/scripts/Sho
'     wCode.asp?txtCodeId=5098&lngWId;=1'for details.'**************************************

VERSION 5.00
Begin VB.Form Form1 
Caption = "Form1"
ClientHeight = 6180
ClientLeft = 210
ClientTop = 1800
ClientWidth = 7575
LinkTopic = "Form1"
ScaleHeight = 6180
ScaleWidth = 7575
Begin VB.PictureBox picOuterFrame 
Appearance = 0 'Flat
ForeColor = &H80000008;&
    Height = 5535
    Left = 120
    ScaleHeight = 5505
    ScaleWidth = 7065
    TabIndex = 0
    Top = 120
    Width = 7095
    Begin VB.PictureBox spltVertical 
    Appearance = 0 'Flat
    CausesValidation= 0 'False
    ClipControls = 0 'False
    FillColor = &H8000000F;&
    FillStyle = 0 'Solid
    ForeColor = &H8000000F;&
        Height = 4935
        Left = 3480
        MousePointer = 9 'Size W E
        ScaleHeight = 4905
        ScaleWidth = 225
        TabIndex = 1
        Top = 0
        Width = 255
        End
        Begin VB.PictureBox picRight 
        Appearance = 0 'Flat
        BackColor = &H80000005;&
        ForeColor = &H80000008;&
            Height = 4815
            Left = 3840
            ScaleHeight = 4785
            ScaleWidth = 2985
            TabIndex = 2
            Top = 240
            Width = 3015
            End
            Begin VB.PictureBox picLeft 
            Appearance = 0 'Flat
            ForeColor = &H80000008;&
                Height = 4575
                Left = 0
                ScaleHeight = 4545
                ScaleWidth = 3345
                TabIndex = 3
                Top = 240
                Width = 3375
                Begin VB.PictureBox spltHorizontal 
                Appearance = 0 'Flat
                FillColor = &H8000000F;&
                FillStyle = 0 'Solid
                ForeColor = &H8000000F;&
                    Height = 255
                    Left = 480
                    MousePointer = 7 'Size N S
                    ScaleHeight = 225
                    ScaleWidth = 2385
                    TabIndex = 4
                    Top = 2160
                    Width = 2415
                    End
                    Begin VB.PictureBox picTopLeft 
                    Appearance = 0 'Flat
                    BackColor = &H80000005;&
                    ForeColor = &H80000008;&
                        Height = 1815
                        Left = 480
                        ScaleHeight = 1785
                        ScaleWidth = 2025
                        TabIndex = 6
                        Top = 120
                        Width = 2055
                        End
                        Begin VB.PictureBox picBottomLeft 
                        Appearance = 0 'Flat
                        BackColor = &H80000005;&
                        ForeColor = &H80000008;&
                            Height = 1815
                            Left = 600
                            ScaleHeight = 1785
                            ScaleWidth = 2025
                            TabIndex = 5
                            Top = 2520
                            Width = 2055
                            End
                            End
                            End
                            End
                            Attribute VB_Name = "Form1"
                            Attribute VB_GlobalNameSpace = False
                            Attribute VB_Creatable = False
                            Attribute VB_PredeclaredId = True
                            Attribute VB_Exposed = False
                            Option Explicit
                            Private Const SPLT_WDTH As Long = 80 'width of the spltter bar
                            Private Const MIN_WINDOW As Long = 10 'Minimum size For any frame created by splitter bars
Private Sub Form_Load()

'**** Splitter Code **** 'No Borders, they are for development an ' d debugging spltVertical.BorderStyle = 0 spltHorizontal.BorderStyle = 0 picOuterFrame.BorderStyle = 0 picLeft.BorderStyle = 0 picTopLeft.BorderStyle = 0 picBottomLeft.BorderStyle = 0 picRight.BorderStyle = 0 '**** End Splitter Code **** End Sub
Private Sub picRight_Resize()
'Resize your object to the inside of the ' frame 'YourObject.Move 0, 0, picRight.Width, p ' icRight.Height End Sub
Private Sub picTopLeft_Resize()
'Resize your object to the inside of the ' frame 'YourObject.Move 0, 0, picTopLeft.Width, ' picTopLeft.Height End Sub
Private Sub picBottomLeft_Resize()
'Resize your object to the inside of the ' frame 'YourObject.Move 0, 0, picBottomLeft.Wid ' th, picBottomLeft.Height End Sub
Private Sub Form_Resize()
'For this example, I chose to reside all ' the frames, depending on the size of the ' ' form. You may choose to put this whole ' assembly in another sub-frame. '**** Splitter Code **** 'Resize the outer frame Dim height1 As Long, width1 As Long height1 = ScaleHeight - (2 * SPLT_WDTH) If height1 < 0 Then height1 = 0 width1 = ScaleWidth - (2 * SPLT_WDTH) If width1 < 0 Then width1 = 0 picOuterFrame.Move SPLT_WDTH, SPLT_WDTH, width1, height1 '**** End Splitter Code **** End Sub
'**** Splitter Code **** Private Sub spltVertical_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then spltVertical.Move (spltVertical.Left - (SPLT_WDTH \ 2)) + x, 0, SPLT_WDTH, picOuterFrame.ScaleHeight spltVertical.BackColor = vbButtonShadow 'change the splitter colour End If
End Sub
Private Sub spltVertical_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If spltVertical.BackColor = vbButtonShadow Then spltVertical.Move (spltVertical.Left - (SPLT_WDTH \ 2)) + x, 0, SPLT_WDTH, picOuterFrame.ScaleHeight End If
End Sub
Private Sub spltVertical_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If spltVertical.BackColor = vbButtonShadow Then spltVertical.BackColor = vbButtonFace 'restore splitter colour spltVertical.Move (spltVertical.Left - (SPLT_WDTH \ 2)) + x, 0, SPLT_WDTH, picOuterFrame.ScaleHeight 'Set the absolute Boundaries Dim lAbsLeft As Long Dim lAbsRight As Long lAbsLeft = MIN_WINDOW lAbsRight = picOuterFrame.ScaleWidth - (SPLT_WDTH + MIN_WINDOW) Select Case spltVertical.Left Case Is < lAbsLeft 'the pane is too thin spltVertical.Move lAbsLeft, 0, SPLT_WDTH, picOuterFrame.ScaleHeight Case Is > lAbsRight 'the pane is too wide spltVertical.Move lAbsRight, 0, SPLT_WDTH, picOuterFrame.ScaleHeight End Select
'reposition both frames, and the spltVer ' tical bar picOuterFrame_Resize End If
End Sub
Private Sub spltHorizontal_MouseDown(Button As Integer, Shift As Integer, x As Single, y As Single)
If Button = vbLeftButton Then spltHorizontal.BackColor = vbButtonShadow 'change the splitter colour spltHorizontal.Move 0, (spltHorizontal.Top - (SPLT_WDTH \ 2)) + y, picLeft.ScaleWidth, SPLT_WDTH End If
End Sub
Private Sub spltHorizontal_MouseMove(Button As Integer, Shift As Integer, x As Single, y As Single)
If spltHorizontal.BackColor = vbButtonShadow Then spltHorizontal.Move 0, (spltHorizontal.Top - (SPLT_WDTH \ 2)) + y, picLeft.ScaleWidth, SPLT_WDTH End If
End Sub
Private Sub splthorizontal_MouseUp(Button As Integer, Shift As Integer, x As Single, y As Single)
If spltHorizontal.BackColor = vbButtonShadow Then spltHorizontal.BackColor = vbButtonFace 'restore splitter colour spltHorizontal.Move 0, (spltHorizontal.Top - (SPLT_WDTH \ 2)) + y, picLeft.ScaleWidth, SPLT_WDTH 'Set the absolute Boundaries Dim lAbsTop As Long Dim lAbsBottom As Long lAbsTop = MIN_WINDOW lAbsBottom = picLeft.ScaleHeight - (SPLT_WDTH + MIN_WINDOW) Select Case spltHorizontal.Top Case Is < lAbsTop 'the pane is too short spltHorizontal.Move 0, lAbsTop, picLeft.ScaleWidth, SPLT_WDTH Case Is > lAbsBottom 'the pane is too tall spltHorizontal.Move 0, lAbsBottom, picLeft.ScaleWidth, SPLT_WDTH End Select
'reposition both sub-frames, and the spl ' tHorizontal bar picLeft_Resize End If
End Sub
Private Sub picOuterFrame_Resize()
Dim x1 As Long Dim x2 As Long Dim y1 As Long On Error Resume Next y1 = picOuterFrame.ScaleHeight x1 = spltVertical.Left x2 = x1 + SPLT_WDTH + 1 picLeft.Move 0, 0, x1 - 1, y1 spltVertical.Move x1, 0, SPLT_WDTH, y1 picRight.Move x2, 0, picOuterFrame.ScaleWidth - x2, y1 'Force a refresh on the left side picLeft_Resize End Sub
Private Sub picLeft_Resize()
'Resize the internal stuff. Only the wid ' th's Dim x1 As Long Dim y1 As Long Dim y2 As Long Dim y3 as Long x1 = picLeft.Width y1 = spltHorizontal.Top y2 = y1 + SPLT_WDTH + 1 'We have to make sure that we do not siz ' e any windows to a negative dimension y3 = y1 - 1 If y3 < MIN_WINDOW Then y3 = MIN_WINDOW End If
picTopLeft.Move 0, 0, x1, y3 spltHorizontal.Move 0, y1, x1, SPLT_WDTH y3 = picLeft.ScaleHeight - y2 If y3 < MIN_WINDOW Then y3 = MIN_WINDOW End If
picBottomLeft.Move 0, y2, x1, y3 End Sub
'**** End Splitter Code ****

 
Report Bad Submission
Use this form to notify us if this entry should be deleted (i.e contains no code, is a virus, etc.).
Reason:
 
Your Vote!

What do you think of this code(in the Intermediate category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor See Voting Log
 
Other User Comments
12/28/1999 8:33:49 PM:Eugene
I fixed a problem in the picLeft_Resize 
routine that would 
give an error if 
you resized the form and the lower left 
picture box would be a negative 
height. (oops)
Comments and 
suggestions are welcomed.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/21/2000 9:06:38 AM:GEEZA
Very cool
I made one of these too, but 
used a user control for it, because 
then it can contain objects and be 
separate from the main code.
Why not 
try the same with Picture boxes dude?
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
1/22/2000 11:53:17 AM:Eugene
Thanks for the idea Geeza! I will post 
it when it is finished.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/18/2000 3:36:30 PM:Jeremy
I pasted the code into a text document 
and renamed it to form1.frm but 
couldn't get it to run. Am I doing 
something wrong?thanks!
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/21/2002 3:30:56 AM:Rob
Aye, you'll have to create a new 
project, go into the code of Form1 and 
paste the code there mate.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
5/21/2002 1:40:15 PM:Elias Barbosa
Awkward way of posting your code!
I 
liked your code, though.
I am giving 
you 5 planets.
Keep the Planet clean! If this comment was disrespectful, please report it:
Reason:

 
Add Your Feedback!
Note:Not only will your feedback be posted, but an email will be sent to the code's author in your name.

NOTICE: The author of this code has been kind enough to share it with you.  If you have a criticism, please state it politely or it will be deleted.

For feedback not related to this particular code, please click here.
 
Name:
Comment:

 

Categories | Articles and Tutorials | Advanced Search | Recommended Reading | Upload | Newest Code | Code of the Month | Code of the Day | All Time Hall of Fame | Coding Contest | Search for a job | Post a Job | Ask a Pro Discussion Forum | Live Chat | Feedback | Customize | Visual Basic Home | Site Home | Other Sites | About the Site | Feedback | Link to the Site | Awards | Advertising | Privacy

Copyright© 1997 by Exhedra Solutions, Inc. All Rights Reserved.  By using this site you agree to its Terms and Conditions.  Planet Source Code (tm) and the phrase "Dream It. Code It" (tm) are trademarks of Exhedra Solutions, Inc.