Results 1 to 4 of 4

Thread: Dragging boxes

  1. #1

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682

    Dragging boxes

    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?
    I don't live here any more.

  2. #2

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    *Bump* sorry, But I'm sure someone knows how to code this. See above.

  3. #3
    PowerPoster 2.0 Negative0's Avatar
    Join Date
    Jun 2000
    Location
    Southeastern MI
    Posts
    4,367
    Something like this?

    VB Code:
    1. Option Explicit
    2. Dim blnDrawSquare As Boolean
    3. Dim StartX As Long
    4. Dim StartY As Long
    5.  
    6. Private Sub Picture1_MouseDown(Button As Integer, Shift As Integer, X As Single, Y As Single)
    7. If Button = 1 Then
    8.  blnDrawSquare = True
    9.  StartX = X
    10.  StartY = Y
    11. End If
    12. End Sub
    13.  
    14. Private Sub Picture1_MouseMove(Button As Integer, Shift As Integer, X As Single, Y As Single)
    15. If blnDrawSquare Then
    16. Picture1.Cls
    17.   Picture1.Line (StartX, StartY)-(X, StartY)
    18. Picture1.Line (StartX, StartY)-(StartX, Y)
    19. Picture1.Line (X, StartY)-(X, Y)
    20. Picture1.Line (StartX, Y)-(X, Y)
    21. End If
    22. End Sub
    23.  
    24. Private Sub Picture1_MouseUp(Button As Integer, Shift As Integer, X As Single, Y As Single)
    25. blnDrawSquare = False
    26. Picture1.Cls
    27. End Sub

  4. #4

    Thread Starter
    type Woss is new Grumpy; wossname's Avatar
    Join Date
    Aug 2002
    Location
    #!/bin/bash
    Posts
    5,682
    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.
    I don't live here any more.

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