home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Visual Basic Programmer'…arterly (Limited Edition)
/
Visual_Basic_Programmers_Journal_VB-CD_Quarterly_Limited_Edition_1995.iso
/
code
/
ch13code
/
scroll.frm
< prev
next >
Wrap
Text File
|
1995-08-12
|
3KB
|
126 lines
VERSION 4.00
Begin VB.Form Form1
BackColor = &H00C0C0C0&
Caption = "Form1"
ClientHeight = 4212
ClientLeft = 1128
ClientTop = 1788
ClientWidth = 6696
Height = 4764
Left = 1080
LinkTopic = "Form1"
ScaleHeight = 4212
ScaleWidth = 6696
Top = 1284
Width = 6792
Begin VB.HScrollBar HScroll1
Height = 255
Left = 0
TabIndex = 1
Top = 3960
Width = 6495
End
Begin VB.VScrollBar VScroll1
Height = 3975
Left = 6480
TabIndex = 0
Top = 0
Width = 255
End
Begin VB.OLE OLE1
BackColor = &H00C0C0C0&
Height = 3975
Left = 0
TabIndex = 2
Top = 0
Width = 6495
End
Begin VB.Menu mnuFile
Caption = "&File"
NegotiatePosition= 1 'Left
Begin VB.Menu mnuNew
Caption = "&New Object"
End
Begin VB.Menu mnuClose
Caption = "&Close Object"
End
Begin VB.Menu mnuSep1
Caption = "-"
End
Begin VB.Menu mnuExit
Caption = "E&xit"
End
End
End
Attribute VB_Name = "Form1"
Attribute VB_Creatable = False
Attribute VB_Exposed = False
Option Explicit
Private Sub Form_Load()
OLE1.SizeMode = vbOLESizeAutoSize
OLE1.InsertObjDlg
End Sub
Private Sub Form_Resize()
' Skip first Resize on Load.
Static bFlag As Boolean
If bFlag Then
' If form resizes, trigger OLE control resize behavior.
OLE1_Resize OLE1.Height, OLE1.Width
Else
bFlag = True
End If
AdjustScrollBars Me
End Sub
Private Sub HScroll1_Change()
OLE1.Left = 0 - HScroll1.VALUE
End Sub
Private Sub mnuClose_Click()
OLE1.Close
End Sub
Private Sub mnuExit_Click()
End
End Sub
Private Sub mnuNew_Click()
OLE1.InsertObjDlg
End Sub
Private Sub VScroll1_Change()
OLE1.TOP = 0 - VScroll1.VALUE
End Sub
Private Sub OLE1_Resize(HeightNew As Single, WidthNew As Single)
If HeightNew > Form1.Height Then
VScroll1.Visible = True
VScroll1.MAX = HeightNew
VScroll1.LargeChange = HeightNew / (HeightNew / OLE1.Height)
VScroll1.SmallChange = VScroll1.LargeChange / 10
Else
VScroll1.Visible = False
Form1.ScaleHeight = OLE1.Height
End If
If WidthNew > Form1.Width Then
HScroll1.Visible = True
HScroll1.MAX = WidthNew
HScroll1.LargeChange = WidthNew / (WidthNew / OLE1.Width)
HScroll1.SmallChange = HScroll1.LargeChange / 10
Else
HScroll1.Visible = False
Form1.ScaleWidth = OLE1.Width
End If
End Sub