How to draw a hexagram

    Private Sub Form1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

        Dim myPen1 As New Pen(New SolidBrush(Color.FromArgb(255, 0, 0, 0)), 10)

        Dim Tri1Point1 As New Point((Me.Width / 2) – Me.Height / 6, (Me.Height / 3) + (Me.Height / 18))
        Dim Tri1Point2 As New Point((Me.Width / 2) + Me.Height / 6, (Me.Height / 3) + (Me.Height / 18))
        Dim Tri1Point3 As New Point((Me.Width / 2), ((Me.Height / 3) * 2) + (Me.Height / 18))

        e.Graphics.DrawPolygon(myPen1, {Tri1Point1, Tri1Point2, Tri1Point3})

        Dim Tri2Point1 As New Point((Me.Width / 2) – Me.Height / 6, ((Me.Height / 3) * 2) – (Me.Height / 18))
        Dim Tri2Point2 As New Point((Me.Width / 2) + Me.Height / 6, ((Me.Height / 3) * 2) – (Me.Height / 18))
        Dim Tri2Point3 As New Point((Me.Width / 2), (Me.Height / 3) – (Me.Height / 18))

        e.Graphics.DrawPolygon(myPen1, {Tri2Point1, Tri2Point2, Tri2Point3})

    End Sub

The code above is Public Domain

Image

Advertisements

Leave a comment

Filed under Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s