Question make a own scrollbar with a limit

iDylan1993

New member
Joined
Feb 13, 2014
Messages
1
Programming Experience
3-5
Hi guys,

I would like to make a scrollbar with limit stops at the top and bottom, but it does work but then stops me picturebox complete and does nothing and is no longer down! Who can help me please?


Sincerely,
dylan


CODE:
Public Class Form1


    Dim startx As Integer
    Dim starty As Integer
    Dim endy As Integer
    Dim endx As Integer
    Dim finalx As Integer
    Dim finaly As Integer
    Dim mdown As Boolean
    Dim valx As Boolean
    Dim valy As Boolean


    Private Sub PictureBox1_MouseDown(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseDown
        starty = MousePosition.Y
        mdown = True
        valx = False
        valy = False
    End Sub


    Private Sub PictureBox1_MouseMove(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseMove
        If mdown = True Then
            endy = (MousePosition.Y - Me.Top)


            If valy = False Then
                starty = endy - sender.top
                valy = True
            End If
            If valx = False Then
                startx = endx - sender.left
                valx = True
            End If
            sender.top = endy - starty
        End If
        If PictureBox1.Location.Y = -2 = True Then
            valy = False
        Else
            If PictureBox1.Location.Y = 136 = True Then
                valy = False
            End If
        End If
    End Sub


    Private Sub PictureBox1_MouseUp(sender As Object, e As MouseEventArgs) Handles PictureBox1.MouseUp
        mdown = False
        valx = False
        valy = False
    End Sub
 

Attachments

Last edited by a moderator:
Top Bottom