User:Pluke/rotation

From Wikibooks, open books for an open world
Jump to navigation Jump to search
   'This code runs each time the invalidate() procedure is called
    Private Sub frmGame_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim pallete As Drawing.Graphics = Me.CreateGraphics
        Dim brush_black As New SolidBrush(Color.Black)

        pallete.FillRectangle(Brushes.DarkGreen, New Rectangle(2, 2, Me.Width - 2, 10))
        pallete.FillRectangle(Brushes.DarkGreen, New Rectangle(2, Me.Height - 40, Me.Width - 2, 10))
        pallete.FillRectangle(brush_black, New Rectangle(bx, by, 70, 10))

        'pallete.Clear(Color.AntiqueWhite)

        pallete.TranslateTransform(bx + 35, by + 5) 'put in the centre of the image
        pallete.RotateTransform(dir)
        pallete.FillRectangle(brush_black, New Rectangle(-35, -5, 70, 10))
        pallete.TranslateTransform(0, 0) 'put in the centre of the image

    End Sub