Hi @ahmedAlie ,
I made some modifications on your code and got the result below.
Add judgment to guarantee maximum and minimum values.
Here is my code.
Public Sub Mouse_Scroll(sender As Object, e As MouseEventArgs) Handles Me.MouseWheel
If e.Delta > 0 Then
If PIC_MALE.Height + CInt(PIC_MALE.Height * e.Delta / 1000) > 100 Then
PIC_MALE.Height = 100
Else
PIC_MALE.Height += CInt(PIC_MALE.Height * e.Delta / 1000)
End If
PIC_MALE.Refresh()
Else
If PIC_MALE.Height + CInt(PIC_MALE.Height * e.Delta / 1000) < 30 Then
PIC_MALE.Height = 30
Else
PIC_MALE.Height += CInt(PIC_MALE.Height * e.Delta / 1000)
End If
End If
Label1.Text = PIC_MALE.Height
End Sub
Hope the code above could be helpful.
Best Regards.
Jiachen Li
----------
If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.