Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with scalable picture window scroll bars

Status
Not open for further replies.

vbesoft

Programmer
Joined
Aug 15, 2002
Messages
6
Location
US
when I set up a scrolable picture window and use the state ments below the scrolable picture window works fine.

Private Sub Form_Load()
Form1.ScaleMode = vbPixels
Picture1.ScaleMode = vbPixels
Picture2.AutoSize = True
Picture1.BorderStyle = 0
Picture2.BorderStyle = 0
Picture3.Left = Picture1.Width
Picture3.Top = Picture1.Height
Picture2.Picture = LoadPicture("C:\flower.jpg")
HScroll1.Top = Picture1.Height
HScroll1.Left = 0
HScroll1.Width = Picture1.Width
VScroll1.Top = 0
VScroll1.Left = Picture1.Width
VScroll1.Height = Picture1.Height
HScroll1.Max = Picture2.Width - Picture1.Width
VScroll1.Max = Picture2.Height - Picture1.Height
Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
Picture2.Move 0, 0
VScroll1.Visible = (Picture1.Height < Picture2.Height)
HScroll1.Visible = (Picture1.Width < Picture2.Width)
End Sub

Private Sub HScroll1_Change()
Picture2.Left = -HScroll1.Value
End Sub

Private Sub VScroll1_Change()
Picture2.Top = -VScroll1.Value
End Sub



But when I add the controls for the Resize button below I lose the scroll bars. The area where they belong is grayed but there are no scroll bars. Can anyone tell me why and how to correct the problem ?

Private Sub Form_Resize()
Picture1.Width = Form1.Width
Picture1.Height = Form1.Height
Picture2.Move 0, 0
Picture3.Left = Picture1.Width
Picture3.Top = Picture1.Height
HScroll1.Top = Picture1.Height
HScroll1.Left = 0
HScroll1.Width = Picture1.Width
VScroll1.Top = 0
VScroll1.Left = Picture1.Width
VScroll1.Height = Picture1.Height
HScroll1.Max = Picture2.Width - Picture1.Width
VScroll1.Max = Picture2.Height - Picture1.Height
Picture1.Move 0, 0, ScaleWidth - VScroll1.Width, ScaleHeight - HScroll1.Height
Picture2.Move 0, 0
VScroll1.Visible = (Picture1.Height < Picture2.Height)
HScroll1.Visible = (Picture1.Width < Picture2.Width)
End Sub

Thanks for any help you can supply
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top