|
-
Mar 3rd, 2001, 11:27 AM
#1
Hi,
I've got a weird problem with the mousedown event on a picturebox.
I'm using the mouse to draw a line on the picturebox while the mousebutton is pressed.
Im saving the startposition (x,y) at mousedown and use the x,y at mousemove to draw the line.
That works fine.
If I start outside this picturebox with mousepressed and move into the box, nothing is shown, so far so good.
But If I'm start anywhere on the menu (mousedown over menu), the line is printed starting
at an old startposition as soon as I move onto the box.
?????????????????????
Does anybody have a clue on that?
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Mar 3rd, 2001, 11:32 AM
#2
Hyperactive Member
It appears as though your app, has mistaken the menu for the picture box. Interesting.
Can you clear the (x, y) coordinates on the mouse down click event for the menu? Or Clear it on the mouse down <> Picturebox?
 Mahalo 
VB6(SP5), VC++, COBOL, Basic, JAVA
MBA, MCSD, MCSE, A+
Computer Forensics
-
Mar 3rd, 2001, 11:36 AM
#3
Post your code up. As Lee M suggested, maybe you're not clearing it, or if you are, it's not in the right event.
-
Mar 3rd, 2001, 11:44 AM
#4
Try the following.
Code:
Private px As Single
Private py As Single
Private InBox As Boolean
Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
If Button = 1 Then
px = X
py = Y
InBox = True
End If
End Sub
Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
If InBox = True Then
If Button = 1 Then
Picture1.Line (px, py)-(X, Y)
px = X
py = Y
End If
End If
End Sub
Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
InBox = False
End Sub
-
Mar 3rd, 2001, 11:46 AM
#5
OK, here's the code:
Karte is the PictureBox
BearDistLine is a LineObject
Code:
Private Sub Karte_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
BearDistLine.X1 = X
BearDistLine.Y1 = Y
End Sub
Private Sub Karte_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
BearDistLine.X2 = X
BearDistLine.Y2 = Y
BearDistLine.Visible = True
End Sub
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
-
Mar 3rd, 2001, 11:52 AM
#6
Did my above code work for you?
-
Mar 3rd, 2001, 11:56 AM
#7
Will try that, Megatron
Thanks
And, I'm did reset my systemclock, you are fast but not THAT fast ;-)
You're welcome to rate this post!
If your problem is solved, please use the Mark thread as resolved button
Wait, I'm too old to hurry!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|