Results 1 to 6 of 6

Thread: aligning graphics in two picture boxes

  1. #1

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    4

    Lightbulb aligning graphics in two picture boxes

    I have two picture boxes that are parrellel to each other on my form.

    When the mouse moves over picturebox1, i draw a line parrallel at the mouse position, and I also want to move a label parallel to the mouse position in picturebox 2.

    but using the Y coord from picturebox1 to set the .top property of the label doesnt work. its offset by a little bit.

    how can i make it exactly parrallel?

    This is the code in picturebox1s mousemove event

    Code:
    picPrice.ScaleHeight = picChart.ScaleHeight
    lblPrice.Top = Y
    picChart is the first picture box, and picPrice is the second.
    and it makes the label offset a little bit to the mouse position

    thanks

  2. #2
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    Is the label in the picturebox or on the form...I can't remember what they call it, but the label has to be made on the picturebox. Look at my example. Does it have the same problem as your app...or is mine working like you want it to do...???
    Attached Files Attached Files

  3. #3

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    4
    Yours works like I want it to, and the code looks the same as mine, but mine doesn't work like yours heh.

    I think the problem has something to do with the scale of the boxes.

    I attached the ctl the code is in if you want to take a look at it. It's a charting control, if you look at it I want the crosshair in the picChart picture box to have the label in picPrice to be parrallel with each other.
    Attached Files Attached Files

  4. #4
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    I have never used a conroll before so I'm not 100% sure what to do with it... So if you don't throw up your example, I don't think I will use that much time to figgure out what is wrong with it...

    But try to set the pictureboxes scalemode to 3...I don't think that has anything to do with it, but just try...

    and an other thing. Look at this projekt and see what I mean by putting the label in the picturebox and not on the form....
    Attached Files Attached Files

  5. #5

    Thread Starter
    New Member
    Join Date
    Dec 2002
    Posts
    4
    you just add the ctl file, then there is an icon in the toolbox, add that to the form and its good to go.

    the lable is made on the picture box...

  6. #6
    Retired G&G Mod NoteMe's Avatar
    Join Date
    Oct 2002
    Location
    @ Opera Software
    Posts
    10,190
    OK i have tied your controll...but I get an error when I load it, and an error when I start my app...and an error when I end my app...

    OK look here...I can't see what you are complaineing about...the label is following the cursor up and down...

    Is your problem that the text in the label is under the cursor??? Because if it is that then the problem is simple. In your code you write that the Y in the mousemove event = the top of the label. But you actually want it to be like the mid of the text. Then You would have to do something like this...

    VB Code:
    1. Label1.Top = Y - (Label1.Height / 2)

    Try that out and tell me if that is your problem....

    BTW I have attached a picture showing what I mean. The black label is your controll now....and the red one is what I mean....

    Attached Images Attached Images  

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