j'ai un control activex contient une Hscroll et Vscroll je charge une image de grande dimension, j'ai un méssage d'erreur de dépassement de capacité
svp de l'aide
l'erreur pointe ici :
HScroll1.value = Abs(ll_left / ll_absMinLeft * HScroll1.Max)
mon code est :
Public Sub scrollToXY(pl_X As Long, pl_Y As Long)
On Error GoTo fin
Dim ll_left As Long
Dim ll_top As Long
Dim ll_absMinLeft As Long
Dim ll_absMinTop As Long
ll_left = pl_X
ll_top = pl_Y
ll_absMinLeft = pbView.ScaleWidth - co_pb.Width
ll_absMinTop = pbView.ScaleHeight - co_pb.Height
If ll_absMinLeft < 0 Then
HScroll1.value = Abs(ll_left / ll_absMinLeft * HScroll1.Max)
End If
If ll_absMinTop < 0 Then
If Abs(ll_top / ll_absMinTop * VScroll1.Max) > VScroll1.Max Then
VScroll1.value = VScroll1.Max
ElseIf Abs(ll_top / ll_absMinTop * VScroll1.Max) < VScroll1.Min Then
VScroll1.value = VScroll1.Min
Else
VScroll1.value = Abs(ll_top / ll_absMinTop * VScroll1.Max)
End If
End If
HScroll1_Change
VScroll1_Change
fin:
If Err = 6 Then
MsgBox error$, vbOK + vbCritical, "Erreur"
Exit Sub
Else
End If
End Sub