wreakaildron
Member
- Joined
- Jan 26, 2007
- Messages
- 6
- Programming Experience
- 5-10
it took me 2 prog rewrites to simplify, 3 posts worth
Last edited:
Public Class Form1[INDENT]Private myRectPoint As New Point[/INDENT][INDENT]Private myRectSize As New Size[/INDENT][INDENT]Const cintRectSize As Integer = 600[/INDENT][INDENT]Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load[/INDENT][INDENT]myRectPoint.X = 10[/INDENT][INDENT]myRectPoint.Y = 50[/INDENT][INDENT]myRectSize.Height() = cintRectSize[/INDENT][INDENT]myRectSize.Width() = cintRectSize[/INDENT][INDENT]End Sub[/INDENT][INDENT]Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint[/INDENT][INDENT]Dim yourRect As New Rectangle(myRectPoint, myRectSize)[/INDENT][INDENT]With e.Graphics[/INDENT][INDENT].DrawRectangle(Pens.DarkGoldenrod, yourRect)[/INDENT][INDENT]End With[/INDENT][INDENT]End Sub[/INDENT][INDENT]Private Sub upButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) _[/INDENT][INDENT]Handles upButton.Click, downButton.Click, leftButton.Click, rightButton.Click[/INDENT][INDENT]Dim tButton As New Button[/INDENT][INDENT]tButton = CType(sender, Button)[/INDENT][INDENT]Select Case tButton.Tag()[/INDENT][INDENT]Case "up"[/INDENT][INDENT]myRectPoint.Y() += 100[/INDENT][INDENT]Case "down"[/INDENT][INDENT]Case "left"[/INDENT][INDENT]Case "right"[/INDENT][INDENT]End Select[/INDENT][INDENT]End Sub[/INDENT]End Class
[INDENT]Case "up"[/INDENT][INDENT]myRectPoint.Y() += 100
Me.Invalidate
[/INDENT]