Does anyone have code for dragging selection boxes on a picturebox control, like the ones used in explorer to highlight multiple files with the mouse?
Printable View
Does anyone have code for dragging selection boxes on a picturebox control, like the ones used in explorer to highlight multiple files with the mouse?
*Bump* sorry, But I'm sure someone knows how to code this. See above.
Something like this?
VB Code:
Option Explicit Dim blnDrawSquare As Boolean Dim StartX As Long Dim StartY As Long Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single) If Button = 1 Then blnDrawSquare = True StartX = X StartY = Y End If End Sub Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single) If blnDrawSquare Then Picture1.Cls Picture1.Line (StartX, StartY)-(X, StartY) Picture1.Line (StartX, StartY)-(StartX, Y) Picture1.Line (X, StartY)-(X, Y) Picture1.Line (StartX, Y)-(X, Y) End If End Sub Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single) blnDrawSquare = False Picture1.Cls End Sub
Well, nearly, I need code that retains the underlying image, this would have been done with XOR drawing in VB6. But since this is not a VB6 forum I'm going to need something else :)
Thanks for trying though.