Results 1 to 2 of 2

Thread: [RESOLVED] Moving a line on a form using HSscrollbar

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Aug 2006
    Posts
    234

    Resolved [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

  2. #2
    Freelancer akhileshbc's Avatar
    Join Date
    Jun 2008
    Location
    Trivandrum, Kerala, India
    Posts
    7,652

    Re: [RESOLVED] Moving a line on a form using HSscrollbar

    Hi...

    Try this:
    vb.net Code:
    1. Public Class Form1
    2.  
    3.     Dim myX1 As Integer
    4.     Dim myX2 As Integer
    5.  
    6.     '~~~ When scrolling the HScrollBar, we'll add new scroll value to the original (X1 & X2)
    7.     Private Sub HScrollBar1_Scroll(ByVal sender As System.Object, ByVal e As System.Windows.Forms.ScrollEventArgs) Handles HScrollBar1.Scroll
    8.         LineShape1.X1 = myX1 + HScrollBar1.Value
    9.         LineShape1.X2 = myX2 + HScrollBar1.Value
    10.     End Sub
    11.  
    12.     '~~~ We are storing the actual position(X1 & X2) of line during the loading time
    13.     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    14.         myX1 = LineShape1.X1
    15.         myX2 = LineShape1.X2
    16.     End Sub
    17. End Class

    If my post was helpful to you, then express your gratitude using Rate this Post.
    And if your problem is SOLVED, then please Mark the Thread as RESOLVED (see it in action - video)
    My system: AMD FX 6100, Gigabyte Motherboard, 8 GB Crossair Vengance, Cooler Master 450W Thunder PSU, 1.4 TB HDD, 18.5" TFT(Wide), Antec V1 Cabinet

    Social Group: VBForums - Developers from India


    Skills: PHP, MySQL, jQuery, VB.Net, Photoshop, CodeIgniter, Bootstrap,...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width