{IP}Gil-Galad
Member
- Joined
- Sep 25, 2005
- Messages
- 19
- Programming Experience
- Beginner
Ok heres my code for what i got so far...
Timer:
Mouse Events:
Panel2 is obvoiusly the panel. Once you click it a red bar shoots up and stops at the top and the blue bar shoots down and stops at the bottom. once they both stopped the line turns black. Now in the code obviously its not finished but you can click in the middle of the red and blue bars moving, and they stop and yours begins, very ugly. Also i need to be able to set that if an objects location is on the one side of the line that the other side fills black. im gessing with fill region or something. Any help would be apprectiated. Also when you right click i want the cursor to change to the side one and when clicked again it changes back and so on. Ive got it so you can hit the right click and hold it down and it changes, but then it changes back.
Regards, Gil
Timer:
VB.NET:
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim gr As Graphics = Panel2.CreateGraphics()
Dim Rpen As New Pen(Color.Red, 5)
Dim Bpen As New Pen(Color.Blue, 5)
Dim Br As Brush = Brushes.Black
Complete = False
If X = 0 Then
X = 1
pointy3 = pointy
pointy2 = pointy
End If
If X = 1 Then
If pointy2 <= 0 Then
pointy2 = 0
End If
If pointy3 >= Me.Height Then
pointy3 = Me.Height
End If
If pointy2 <= 0 And pointy3 >= Me.Height Then
Timer1.Enabled = False
pointy3 = pointy
pointy2 = pointy
Complete = True
End If
If pointy2 <= 5 And pointy3 >= Me.Height - 5 Then
Rpen.Color = Color.Black
Bpen.Color = Color.Black
End If
gr.DrawLine(Rpen, pointx, pointy, pointx, pointy2)
gr.DrawLine(Bpen, pointx, pointy, pointx, pointy3)
If Complete = False Then
pointy2 -= 4
pointy3 += 4
End If
End If
End Sub
VB.NET:
Private Sub Panel2_MouseDown(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles Panel2.MouseDown
If e.Button = MouseButtons.Left Then
pointx = e.X
pointy = e.Y
If Complete = True Then
Timer1.Enabled = True
End If
End If
End Sub
Panel2 is obvoiusly the panel. Once you click it a red bar shoots up and stops at the top and the blue bar shoots down and stops at the bottom. once they both stopped the line turns black. Now in the code obviously its not finished but you can click in the middle of the red and blue bars moving, and they stop and yours begins, very ugly. Also i need to be able to set that if an objects location is on the one side of the line that the other side fills black. im gessing with fill region or something. Any help would be apprectiated. Also when you right click i want the cursor to change to the side one and when clicked again it changes back and so on. Ive got it so you can hit the right click and hold it down and it changes, but then it changes back.
Regards, Gil