Results 1 to 7 of 7

Thread: Graphs (and sex!!)

  1. #1
    Guest

    Post

    Can someone tell me how (in detail) to take a picture box, draw an X line and a Y line in the middle, then whever you move the mouse in the graph, it show the coordinates? Anything will be helpfull.

  2. #2
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Post

    Code:
    Private Sub Form_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
        Cls
        Line (X, 0)-(X, ScaleHeight)
        Line (0, Y)-(ScaleWidth, Y)
        Caption = X & "," & Y
    End Sub
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

  3. #3
    Guest

    Post Thanks, but...

    Thanks kedaman, thats pretty cool, but its not quite what im looking for. What i was talking about is two lines (X and Y) in the middle, and the intersection is 0. Then where ever you put the mouse, it will send the coordinates back to a label.

  4. #4
    Lively Member
    Join Date
    May 1999
    Location
    KC
    Posts
    72

    Lightbulb

    I think this may be what you want:

    To draw the axes:
    Code:
    Picture1.Line (Picture1.Width / 2, 0)-(Picture1.Width / 2, Picture1.Height)
    Picture1.Line (0, Picture1.Height / 2)-(Picture1.Width, Picture1.Height / 2)
    And to track the mouse in the box:
    Code:
    Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    Label1.Caption = "X:" & X - (Picture1.Width / 2) & "  Y:" & (Picture1.Height / 2) - Y
    End Sub

  5. #5
    Guest

    Post Thanks!!!

    Thats exactly what i was looking for, thank you so much!!!!!

  6. #6
    Guest

    Post Ok, what now

    Ok i got that part to work, now when i give the graph two points to make a line, it screws up.

  7. #7
    transcendental analytic kedaman's Avatar
    Join Date
    Mar 2000
    Location
    0x002F2EA8
    Posts
    7,221

    Talking

    Sorry, I missunderstood you last time. You really shoud chech out the scaleleft/scaletop/scalewidth/scaleheight properties if you're making graphs, they can be pretty useful. You may integrate scaling zoom and movement and graphs always show correct.
    Use
    writing software in C++ is like driving rivets into steel beam with a toothpick.
    writing haskell makes your life easier:
    reverse (p (6*9)) where p x|x==0=""|True=chr (48+z): p y where (y,z)=divMod x 13
    To throw away OOP for low level languages is myopia, to keep OOP is hyperopia. To throw away OOP for a high level language is insight.

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