Ok, First thing first... I have not tried this on Win8, so just an assumption at the moment.
The Following code works on XP(SP3), Vista, & Win7 so far, but after giving my app to a friend who was suckered into Win10 because of the "Free" deal, says it's no longer working. The Applicatiuon runs, but doesnt work, & throws No Errors whatsoever.
RubberBanding Code:
Expand|Select|Wrap|Line Numbers
- Private _RubberBandingOn As Boolean = False
- Private _Start As New Point
- Private _Stop As New Point
- Private _Now As New Point
- Private _rRectangle As New Rectangle
- Private Sub Form1_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseDown
- PictureBox2.Visible = False
- Me._RubberBandingOn = Not _RubberBandingOn
- If Me._RubberBandingOn Then
- If _Start = Nothing Then _Start = New Point
- _Start.X = e.X
- _Start.Y = e.Y
- _Now.X = e.X
- _Now.Y = e.Y
- End If
- Me.Invalidate()
- End Sub
- Private Sub Form1_MouseMove(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseMove
- If Me._RubberBandingOn Then
- If _Now = Nothing Then _Now = New Point
- Me._Now.X = e.X
- Me._Now.Y = e.Y
- Me.Invalidate()
- End If
- Me.Cursor = Cursors.Cross
- Me.ToolTip1.SetToolTip(Me, e.X.ToString & ", " & e.Y.ToString)
- End Sub
- Private Sub Form1_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Me.MouseUp
- Me._RubberBandingOn = Not Me._RubberBandingOn
- If Not Me._RubberBandingOn Then
- If _Stop = Nothing Then _Stop = New Point
- _Stop.X = e.X
- _Stop.Y = e.Y
- Me.Invalidate()
- If _rRectangle.Width > 20 AndAlso _rRectangle.Height > 20 Then
- PictureBox2.Location = _rRectangle.Location
- PictureBox2.Size = _rRectangle.Size
- PictureBox2.Visible = True
- Else
- GC.Collect()
- End If
- End If
- End Sub
Any help is awesome as usual.
Thanks.
DTeCH