Posts

Showing posts from April, 2016

How to Create a Star Rotation Program in VB.net

Design View :
                    Take two control button and timer control and not change any property.
Code View :

Public Class Form1
    Dim g As Graphics

    ' variable declaration
    Dim theta As Double = 3.1415 / 180
    Dim t(5) As Double
    Dim i As Integer = 1
    Dim xc, yc, r, cx, cy As Integer


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Timer1.Start() ' timer is star to draw the star
    End Sub

    Public Sub drawstar()
        g = Me.CreateGraphics
        g.Clear(Color.White)


        r = 80 ' size of object

        ' find a center point of the screen and assign a value of variable
        cx = (Me.Width / 2) - 30
        cy = (Me.Height / 2) - 30

        ' find out the xc and yc center point of the circle
        xc = CInt(cx + Math.Cos(t(0)))
        yc = CInt(cy + Math.Sin(t(0)))

        ' find the acutal point of the draw the star
        Dim pts1(5) As Point
        For k As Integer = …