[RESOLVED] Moving a line on a form using HSscrollbar
Hi everyone, trying to move a lineshape (line), across or down my form, but not having any luck with it, I think it is something like this, (but it not quite right)
Can any please help on this one??
LineShape1.X1 & LineShape1.X2 = val (HScrollBar1.Value)
Thanks
Re: [RESOLVED] Moving a line on a form using HSscrollbar
Hi...:wave:
Try this:
vb.net Code:
Public Class Form1
Dim myX1 As Integer
Dim myX2 As Integer
'~~~ When scrolling the HScrollBar, we'll add new scroll value to the original (X1 & X2)
Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
LineShape1.X1 = myX1 + HScrollBar1.Value
LineShape1.X2 = myX2 + HScrollBar1.Value
End Sub
'~~~ We are storing the actual position(X1 & X2) of line during the loading time
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
myX1 = LineShape1.X1
myX2 = LineShape1.X2
End Sub
End Class
:wave: