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
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...???
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.
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....
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:
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....