*/
Love this site? Hate it? Leave us some comments.
*/

View \STRETCH.FRM

Form strecher (VB4)

Submitted By: WEBMASTER
Rating: (Not rated) (Rate It)


VERSION 4.00
Begin VB.Form frmStretch
   Caption         =   "Stretch"
   ClientHeight    =   2655
   ClientLeft      =   690
   ClientTop       =   2385
   ClientWidth     =   8655
   Height          =   3060
   Left            =   630
   LinkTopic       =   "Form1"
   ScaleHeight     =   2655
   ScaleWidth      =   8655
   Top             =   2040
   Width           =   8775
   Begin VB.Frame Frame1
      Caption         =   "Stretch Mode"
      Height          =   1215
      Left            =   6240
      TabIndex        =   12
      Top             =   1200
      Width           =   2175
      Begin VB.CheckBox Check1
         Alignment       =   1  'Right Justify
         Caption         =   "Stretch Vertical"
         Height          =   255
         Left            =   120
         TabIndex        =   14
         Top             =   720
         Width           =   1935
      End
      Begin VB.CheckBox Check2
         Alignment       =   1  'Right Justify
         Caption         =   "Stretch Horizontal"
         Height          =   255
         Left            =   120
         TabIndex        =   13
         Top             =   360
         Value           =   1  'Checked
         Width           =   1935
      End
   End
   Begin VB.TextBox Text5
      Height          =   285
      Left            =   4320
      TabIndex        =   10
      Top             =   1680
      Width           =   1695
   End
   Begin VB.TextBox Text4
      Height          =   285
      Left            =   1560
      TabIndex        =   8
      Top             =   1680
      Width           =   615
   End
   Begin VB.CommandButton Command2
      Cancel          =   -1  'True
      Caption         =   "Cancel"
      Height          =   375
      Left            =   7080
      TabIndex        =   7
      Top             =   720
      Width           =   1335
   End
   Begin VB.TextBox Text3
      Height          =   285
      Left            =   1560
      TabIndex        =   5
      Top             =   1200
      Width           =   4455
   End
   Begin VB.TextBox Text2
      Height          =   285
      Left            =   1560
      TabIndex        =   3
      Text            =   "http://ourworld.compuserve.com/homepages/interface_enterprises"
      Top             =   720
      Width           =   4455
   End
   Begin VB.TextBox Text1
      Height          =   285
      Left            =   1560
      TabIndex        =   2
      Top             =   240
      Width           =   4455
   End
   Begin VB.CommandButton Command1
      Caption         =   "OK"
      Default         =   -1  'True
      Height          =   375
      Left            =   7080
      TabIndex        =   0
      Top             =   240
      Width           =   1335
   End
   Begin VB.Label Label5
      Alignment       =   1  'Right Justify
      Caption         =   "Zip Code:"
      Height          =   255
      Left            =   3000
      TabIndex        =   11
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label4
      Alignment       =   1  'Right Justify
      Caption         =   "State:"
      Height          =   255
      Left            =   240
      TabIndex        =   9
      Top             =   1680
      Width           =   1215
   End
   Begin VB.Label Label3
      Alignment       =   1  'Right Justify
      Caption         =   "City:"
      Height          =   255
      Left            =   240
      TabIndex        =   6
      Top             =   1200
      Width           =   1215
   End
   Begin VB.Label Label2
      Alignment       =   1  'Right Justify
      Caption         =   "Web Site:"
      Height          =   255
      Left            =   120
      TabIndex        =   4
      Top             =   720
      Width           =   1335
   End
   Begin VB.Label Label1
      Alignment       =   1  'Right Justify
      Caption         =   "Name:"
      Height          =   255
      Left            =   120
      TabIndex        =   1
      Top             =   240
      Width           =   1335
   End
End
Attribute VB_Name = "frmStretch"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit

'
' define new stretch object, to handle control moves
'
Dim csStretch As New FormStretch
Dim csStretchFrame As New FormStretch
'
' list of objects to resize/move when form size is changed
'
Dim StretchObjects() As Object

Private Sub SetStretchMode()
   Dim NewMode As Integer
   '
   ' if user wants to stretch vertically
   '
   If Check1.Value Then
      '
      ' set the new mode
      '
      NewMode = 1
   Else
      NewMode = 0
   End If
   '
   ' if user wants to stretch vertically
   '
   If Check2.Value Then
      '
      ' add horizontal bit
      '
      NewMode = NewMode Or 2
   End If
   '
   ' set new stretch mode in class
   '
   csStretch.Mode = NewMode
   csStretchFrame.Mode = NewMode
End Sub

Private Sub Check1_Click()
   '
   ' set new stretch mode
   '
   SetStretchMode
End Sub

Private Sub Check2_Click()
   '
   ' set new stretch mode
   '
   SetStretchMode
End Sub


Private Sub Command1_Click()
MsgBox "Visit http://ourworld.compuserve.com/homepages/interface_enterprises for more VB4/5 classes"
Unload Me
End
End Sub

Private Sub Form_Load()
   '
   ' stretch horizontally
   '
   csStretch.Mode = 2
   '
   ' stretch the current form
   '
   Set csStretch.Client = Me
   '
   ' make list of controls to stretch
   '
   ReDim StretchObjects(1 To 13)
   Set StretchObjects(1) = Label1
   Set StretchObjects(2) = Label2
   Set StretchObjects(3) = Label3
   Set StretchObjects(4) = Label4
   Set StretchObjects(5) = Label5
   Set StretchObjects(6) = Text1
   Set StretchObjects(7) = Text2
   Set StretchObjects(8) = Text3
   Set StretchObjects(9) = Text4
   Set StretchObjects(10) = Text5
   Set StretchObjects(11) = Command1
   Set StretchObjects(12) = Command2
   Set StretchObjects(13) = Frame1
   '
   ' tell stretch class which controls to stretch
   '
   csStretch.AddChildren StretchObjects()
   '
   ' Setup stretch for frame
   ' stretch horizontally
   '
   csStretchFrame.Mode = 2
   '
   ' stretch the frame
   '
   Set csStretchFrame.Client = Frame1
   '
   ' make list of controls to stretch
   '
   ReDim StretchObjects(1 To 2)
   Set StretchObjects(1) = Check1
   Set StretchObjects(2) = Check2
   '
   ' tell stretch class which controls to stretch
   '
   csStretchFrame.AddChildren StretchObjects
End Sub

Private Sub Form_Resize()
   '
   ' resize/move controls when the form size is changed
   '
   csStretch.Stretch
   csStretchFrame.Stretch
End Sub

corner
© 1996-2008 CommunityHeaven LLC. All rights reserved. Reproduction in whole or in part, in any form or medium without express written permission is prohibited.
Violators of this policy may be subject to legal action. Please read our Terms Of Use and Privacy Statement for more information.
North American business development: Nicolai Wadstrom. Publisher: Lars Hagelin.