Results 1 to 8 of 8

Thread: Line Control Problem

  1. #1
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330

    Line Control Problem

    Hello

    I have many line controls on my form. I want to display a value in the middle of the line control. So when the user moves the line control at run - time, the value will always stay in the centre of the line.

    Many thanks in advance
    steve

  2. #2
    Not NoteMe SLH's Avatar
    Join Date
    Mar 02
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Do you mean you want to display something at the centre of a line, or move the line's centre to where the user clicks??
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  3. #3
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330
    What to display something at the lines centre
    steve

  4. #4
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330
    Code:
    Dim YPos As Single
        Dim XPos As Single
        
        With Line1
            XPos = .X2 - X1
            YPos = .Y2 - Y1
        End With
        
        With Label1
            .Left = XPos
            .Top = YPos
        End With
    steve

  5. #5
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330
    I have tried that code, but it display the label at one end of the line and not the centre.
    steve

  6. #6
    Not NoteMe SLH's Avatar
    Join Date
    Mar 02
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    VB Code:
    1. Label1.left = Line.X1 + ((Line1.X2 - Line1.X1)/2) - (Label1.Width/2)
    2. Label1.top = Line.Y1 + ((Line1.Y2 - Line1.Y1)/2)

    Call that whenever the line moves.

    EDIT: Changed for your objects, and made it place the label properly in the middle.
    Last edited by SLH; Apr 19th, 2002 at 01:59 PM.
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


  7. #7
    Frenzied Member
    Join Date
    Dec 01
    Posts
    1,330
    Thanks for your reply. that piece of code works wonders.

    Thanks
    steve

  8. #8
    Not NoteMe SLH's Avatar
    Join Date
    Mar 02
    Location
    192.168.0.1 Preferred Animal: Penguin Reason for errors: Line#38
    Posts
    3,051
    Glad i could help
    Quotes:
    "I am getting better then you guys.." NoteMe, on his leet english skills.
    "And I am going to meat her again later on tonight." NoteMe
    "I think you should change your name to QuoteMe" Shaggy Hiker, regarding NoteMe
    "my sweet lord jesus. I've decided never to have breast implants" Tom Gibbons
    Have I helped you? Please Rate my posts.


Posting Permissions

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