Quantcast
Channel: VBForums - Visual Basic .NET
Viewing all articles
Browse latest Browse all 27081

VS 2012 Graphics Program for my class

$
0
0
Hello:wave:

First time posting here, in dire need of help

I'm doing a simple program for one of my classes and it needs to include an animation. I'm barely getting started but I am curious on how to make my project awesome so I can get some much needed extra credit.

Basically I need to include an If-Then AND Loop (Do While or For-Next)

Also, I have to include Random Numbers, timer control, simple animation(using setbounds method), WAV files, drag-drop and a lot of creativity.

What I'm trying to accomplish with my program is to have a Christmas tree and when I click a button presents come out, children pop out (I'm guessing picture box with kids on it?) and the Christmas tree lights up. How exactly do to I go about making this happen?

My code thus far:

Option Strict On

Public Class Form1
'Declare random
Private GenerateRandom As Random = New Random(DateTime.Now.Millisecond)

Private Sub Form1_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint

'Define the points of the polygons for tree
Dim A1 As New Point(250, 70)
Dim A2 As New Point(140, 145)
Dim A3 As New Point(360, 145)
Dim TopBranchPoints As Point() = {A1, A2, A3}

Dim B1 As New Point(250, 120)
Dim B2 As New Point(100, 220)
Dim B3 As New Point(400, 220)
Dim MidBranchPoints As Point() = {B1, B2, B3}

Dim C1 As New Point(250, 160)
Dim C2 As New Point(70, 300)
Dim C3 As New Point(430, 300)
Dim BottomBranchPoints As Point() = {C1, C2, C3}

'Define the points for the christmas tree STAR decoration
Dim D1 As New Point(250, 30)
Dim D2 As New Point(235, 65)
Dim D3 As New Point(265, 65)
Dim NorthPoint As Point() = {D1, D2, D3}

Dim F1 As New Point(220, 65)
Dim F2 As New Point(250, 50)
Dim F3 As New Point(250, 80)
Dim WestPoint As Point() = {F1, F2, F3}

Dim H1 As New Point(250, 100)
Dim H2 As New Point(235, 65)
Dim H3 As New Point(265, 65)
Dim SouthPoint As Point() = {H1, H2, H3}

Dim J1 As New Point(280, 65)
Dim J2 As New Point(250, 50)
Dim J3 As New Point(250, 80)
Dim EastPoint As Point() = {J1, J2, J3}

'Draw the filled green polygon(Christmas tree)
e.Graphics.FillPolygon(Brushes.LimeGreen, TopBranchPoints)
e.Graphics.FillPolygon(Brushes.LimeGreen, MidBranchPoints)
e.Graphics.FillPolygon(Brushes.LimeGreen, BottomBranchPoints)

'Fill out the star
e.Graphics.FillPolygon(Brushes.DarkKhaki, NorthPoint)
e.Graphics.FillPolygon(Brushes.DarkKhaki, SouthPoint)
e.Graphics.FillPolygon(Brushes.DarkKhaki, WestPoint)
e.Graphics.FillPolygon(Brushes.DarkKhaki, EastPoint)

'Draw the filled brown rectangle(Base of christmas tree)
e.Graphics.FillRectangle(Brushes.Brown, 200, 300, 100, 80)

'Draw the christmas tree decorations
e.Graphics.FillEllipse(Brushes.Red, 280, 150, 20, 20)
e.Graphics.FillEllipse(Brushes.Blue, 200, 150, 20, 20)
e.Graphics.FillEllipse(Brushes.DarkGreen, 242, 130, 20, 20)
e.Graphics.FillEllipse(Brushes.AliceBlue, 290, 180, 20, 20)
e.Graphics.FillEllipse(Brushes.LightPink, 180, 180, 20, 20)

End Sub

Private Sub ExitToolStripMenuItem_Click(sender As Object, e As EventArgs) Handles ExitToolStripMenuItem.Click
Me.Close()
End Sub
End Class
------------------

Basically all I have is the Christmas tree drawn, I already have the button.

Now to reiterate what I need...

How do i make it look like the tree is inside a house? As in perhaps add a little rug under and in the background there's the all with a window.(I'm guessing same way I drew the tree?)

When I click the button what needs to happen is the Christmas tree lights up (or at least the star). Two picture boxes of presents appear that move back and forth around the tree(maybe adding the kids too will be too much). Add a Christmas song. Somehow include the use of random numbers (maybe snow coming out from outside the window?)

Please let me know if anyone can help me out, I hope it's not too ambitious for a starting programmer :afrog:

Viewing all articles
Browse latest Browse all 27081


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>