K
kimiraikkonen
Hi,
If previous post was missing, here's the complete one:
I'm trying to draw a rectange on a picturebox image using mouse move
event but the problem is that the rectangle selection / drawing cannot
be done from starting from bottom-right to up-left. The only selection
i'm allowed to do is starting from top-left towards bottom-right
orientation.
The code is:
Dim cropX As Integer
Dim cropY As Integer
Dim cropWidth As Integer
Dim cropHeight As Integer
Private Sub p_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles p.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
' need to take into count where the mouse started at
'and calculate the new position
cropWidth = e.X - cropX
cropHeight = e.Y - cropY
'draw the outline for the cropping, "p" is picbox.
p.CreateGraphics.DrawRectangle(Pens.Aqua, cropX, cropY, cropWidth,
cropHeight)
End If
End Sub
I can only select rectangle from top-left towards bottom-righ.
Shortly, the selection is NOT freehand, fixed direction. How can i
correct this?
Thanks!
If previous post was missing, here's the complete one:
I'm trying to draw a rectange on a picturebox image using mouse move
event but the problem is that the rectangle selection / drawing cannot
be done from starting from bottom-right to up-left. The only selection
i'm allowed to do is starting from top-left towards bottom-right
orientation.
The code is:
Dim cropX As Integer
Dim cropY As Integer
Dim cropWidth As Integer
Dim cropHeight As Integer
Private Sub p_MouseMove(ByVal sender As Object, ByVal e As
System.Windows.Forms.MouseEventArgs) Handles p.MouseMove
If e.Button = Windows.Forms.MouseButtons.Left Then
' need to take into count where the mouse started at
'and calculate the new position
cropWidth = e.X - cropX
cropHeight = e.Y - cropY
'draw the outline for the cropping, "p" is picbox.
p.CreateGraphics.DrawRectangle(Pens.Aqua, cropX, cropY, cropWidth,
cropHeight)
End If
End Sub
I can only select rectangle from top-left towards bottom-righ.
Shortly, the selection is NOT freehand, fixed direction. How can i
correct this?
Thanks!