Results 1 to 3 of 3

Thread: [RESOLVED] Change mouseicon when X is near from line?

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Resolved [RESOLVED] Change mouseicon when X is near from line?

    I've a picturebox where I've 2 vertical straight lines in a program where I want to represent a raw waveform in that picturebox.

    1 line is green and it's in the left (I use it to indicate the beginning of the selection).
    1 line is red and it's in the right (I use it to indicate the selection end).

    When the mouse is near (left or right) from the green/red line then the icon changes to Me.MousePointer = 9. When the mouse is far from those areas then the mousepointer value is zero.

    I can accomplish this with one of the lines.
    Code:
    (In PictureBox1_MouseMove)
    
    If X > Picture1.X1 -300 And X < Picture1.X1 + 300 Then 
         Me.MousePointer = 9
    Else
         Me.MousePointer = 0
    End If
    This part works ok because I'm doing it with 1 line only. The problem is when I try to do with both lines (green and red lines) because the area where the mousepointer must change in the red line is considered "Else" case and then the mouse becomes crazy.

    I've tried to use the Select Case, but in this attemp to accomplish the same task, the mousepointer doesn't change.

    What is the correct way to write the code?

  2. #2
    VB-aholic & Lovin' It LaVolpe's Avatar
    Join Date
    Oct 2007
    Location
    Beside Waldo
    Posts
    19,541

    Re: Change mouseicon when X is near from line?

    In your else statement, use similar logic to test if the mouse is near the other line's .X1
    Insomnia is just a byproduct of, "It can't be done"

    Classics Enthusiast? Here's my 1969 Mustang Mach I Fastback. Her sister '67 Coupe has been adopted

    Newbie? Novice? Bored? Spend a few minutes browsing the FAQ section of the forum.
    Read the HitchHiker's Guide to Getting Help on the Forums.
    Here is the list of TAGs you can use to format your posts
    Here are VB6 Help Files online


    {Alpha Image Control} {Memory Leak FAQ} {Unicode Open/Save Dialog} {Resource Image Viewer/Extractor}
    {VB and DPI Tutorial} {Manifest Creator} {UserControl Button Template} {stdPicture Render Usage}

  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Mar 2012
    Posts
    290

    Re: Change mouseicon when X is near from line?

    Quote Originally Posted by LaVolpe View Post
    In your else statement, use similar logic to test if the mouse is near the other line's .X1
    I've solved it. I create 2 areas (1 for the green line and the other for the red line) and I follow the next:
    Code:
    If (X>PreGreenLine And X<PostGreenLine) Or (X>PreRedLine And X<PostRedLine) Then
         Me.MousePointer = 3
    Else
         Me.MousePointer = 0
    End If
    Thanks anyway.

Tags for this Thread

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