1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
| Option Explicit
Private Sub Form_Load()
'--------------- partie code pour la démonstration ----------------------------------
Form1.ScaleMode = vbTwips
Form1.Height = 6300: Form1.Width = 7170
'placement et dimmensionnement
PictConteneur.Move 360, 360, 6495, 5295
PictInterne.Appearance = 0: PictInterne.BorderStyle = 1
PictInterne.AutoRedraw = True
PictInterne.Move 0, 0, (PictConteneur.ScaleWidth * 3), PictConteneur.ScaleHeight * 3
'pour repèrer le deplacement avec les Scrolls
PictInterne.Print "Haut gauche"
PictInterne.CurrentX = 0
PictInterne.CurrentY = PictInterne.ScaleHeight - 210
PictInterne.Print "Bas gauche"
PictInterne.CurrentX = PictInterne.ScaleWidth - 840
PictInterne.CurrentY = 0
PictInterne.Print "Haut droite"
PictInterne.CurrentX = PictInterne.ScaleWidth - 780
PictInterne.CurrentY = PictInterne.ScaleHeight - 210
PictInterne.Print "Bas droite"
PictInterne.CurrentX = (PictInterne.ScaleWidth / 2) - 540
PictInterne.CurrentY = (PictInterne.ScaleHeight / 2) - 120
PictInterne.Print "Centre"
PictInterne.Line (0, 0)-(PictInterne.ScaleWidth, PictInterne.ScaleHeight)
PictInterne.Line (0, PictInterne.ScaleHeight)-(PictInterne.ScaleWidth, 0)
HScroll1.Move 300, 60, 6495, 255
VScroll1.Move 60, 360, 255, 5295
'--------------- fini partie code pour la démonstration ----------------------------------
'*************** la partie configuration des Scrolls ******************
HScroll1.Max = (PictInterne.ScaleWidth - PictConteneur.ScaleWidth) + 90
HScroll1.Min = 0
HScroll1.SmallChange = 15
HScroll1.LargeChange = 15
HScroll1.Value = HScroll1.Max / 2 '<--------- pour la démonstration
VScroll1.Max = (PictInterne.ScaleHeight - PictConteneur.ScaleHeight) + 90
VScroll1.Min = 0
VScroll1.SmallChange = 15
VScroll1.LargeChange = 15
VScroll1.Value = VScroll1.Max / 2 '<--------- pour la démonstration
End Sub
'*********************** le code pour faire bouger le picture deposé sur le picture conteneur **********************
Private Sub HScroll1_Change()
'deplacement horizontal
PictInterne.Left = -HScroll1.Value
End Sub
Private Sub HScroll1_Scroll()
HScroll1_Change
End Sub
Private Sub VScroll1_Change()
'deplacement vertical
PictInterne.Top = -VScroll1.Value
End Sub
Private Sub VScroll1_Scroll()
VScroll1_Change
End Sub |
Partager