27
Dim MyBrush As New SolidBrush(Color.Black) EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50, 150, 20, 20)

Dim MyBrush As New SolidBrush(Color.Black)

  • Upload
    arnav

  • View
    42

  • Download
    4

Embed Size (px)

DESCRIPTION

Dim MyBrush As New SolidBrush(Color.Black) EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50, 150, 20, 20). Dim MyBrush As New SolidBrush(Color.Black) Dim shtXOffset, shtYOffset As Short For shtXOffset = 0 To 500 - PowerPoint PPT Presentation

Citation preview

Page 1: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Black)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50, 150, 20, 20)

Page 2: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Black)

Dim shtXOffset, shtYOffset As Short

For shtXOffset = 0 To 500

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50 + shtXOffset, 150, 20, 20)

Sleep(30)

Next shtXOffset

Demo one

Page 3: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Black)

Dim shtXOffset, shtYOffset As Short

For shtXOffset = 0 To 500 Step

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50 + shtXOffset, 150, 20, 20)

Sleep(30)

Next shtXOffset

Page 4: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Black)

Dim shtXOffset, shtYOffset As Short

For shtXOffset = 0 To 500 Step

shtYOffset = shtXOffset / 4

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 50 + shtXOffset, 150 - shtYOffset , 20, 20)

Sleep(30)

Next shtXOffset

Note that the arguments to the graphics functions can be fractions, the function will convert them to integers

Page 5: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Black)

Dim shtXOffset, shtYOffset As Short

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120, 110, 20, 20)

Page 6: Dim  MyBrush As  New  SolidBrush(Color.Black)

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)

For shtXOffset = 0 To 120

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120 + shtXOffset, 110, 20, 20)

Sleep(30)

Next shtXOffset

Page 7: Dim  MyBrush As  New  SolidBrush(Color.Black)

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)For shtXOffset = 0 To 120 MyBrush.Color = Color.Black EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120 + shtXOffset, 110, 20, 20) Sleep(30) MyBrush.Color = Color.White EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120 + shtXOffset, 110, 20, 20) Next shtXOffset

Demo Two

Page 8: Dim  MyBrush As  New  SolidBrush(Color.Black)

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 350, 10, 200, 200)

For shtXOffset = 0 To 120 MyBrush.Color = Color.Black EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120 + shtXOffset, 110, 20, 20) EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 370 + shtXOffset, 110, 20, 20) Sleep(30) MyBrush.Color = Color.White EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 120 + shtXOffset, 110, 20, 20) EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 370 + shtXOffset, 110, 20, 20)

Next shtXOffset

Demo Three

Page 9: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.RoyalBlue)

Dim shtI As Short

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 150, 60, 100, 100)

MyBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 190, 100, 20, 20)

Page 10: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.RoyalBlue)

Dim shtI As Short EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 150, 60, 100, 100)

MyBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 190, 100, 20, 20)

For shtI = 0 To 20

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 190 - shtI, 100 - shtI, 20 + (shtI * 2), 20 + (shtI * 2))

Sleep(50)

Next shtI

Demo Four

Page 11: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.RoyalBlue)

Dim shtI, shtYOffset As Short

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10, 200, 200)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 150, 60, 100, 100)

MyBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 190, 100, 20, 20)

For shtI = 0 To 40

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.Black, 100, 10 + shtI, 200, 200 - (shtI * 2))

Sleep(70)

EamonnsPicBox.CreateGraphics.DrawEllipse(Pens.White, 100, 10 + shtI, 200, 200 - (shtI * 2))

Next shtI

Squinting eye

Page 12: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim shtI, shtX, shtY As Short

For shtI = 1 To 200

shtX = ((696 + 1) * Rnd())

shtY = ((224 + 1) * Rnd())

EamonnsPicBox.CreateGraphics.DrawLine(Pens.White, shtX, shtY, shtX, shtY + 1)

Next shtI

Page 13: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim shtI, shtX, shtY As Short

For shtI = 1 To 200

shtX = shtX + ((Rnd() * 3)) - 1

EamonnsPicBox.CreateGraphics.DrawLine(Pens.Yellow, 200 + shtX, 0 + shtI, 200 + shtX, 1 + shtI)

Sleep(3)

Next shtI

Page 14: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyBrush As New SolidBrush(Color.Wheat)

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 100, 10, 80, 80)

MyBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 80, 10, 80, 80)

There is a mistake above, how do we fix it?

Page 15: Dim  MyBrush As  New  SolidBrush(Color.Black)

For shtI = 1 To 224

MyBrush.Color = Color.White

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 200 + shtI, 0 + shtI, 5, 5)

Sleep(10)

MyBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(MyBrush, 200 + shtI, 0 + shtI, 5, 5)

Next shtI

Demo Five

Page 16: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim shtI As Short

For shtI = 0 To 400

myBrush.Color = Color.Red

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 0 + shtI, 180)

myBrush.Color = Color.Yellow

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 180 + shtI, 180)

Sleep(20)

Next shtI

Demo Six

Page 17: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim shtI As Short

For shtI = 0 To 40

myBrush.Color = Color.Red

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 0 + shtI, 90)

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 180 + shtI, 90)

myBrush.Color = Color.Yellow

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 90 + shtI, 90)

EamonnsPicBox.CreateGraphics.FillPie(myBrush, 100, 10, 200, 200, 270 + shtI, 90)

Sleep(20)

Next shtI

Page 18: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyFont = New Font("Arial", 46)

Dim shtX, shtY As Short

Dim strLocation As String

shtX = EamonnsPicBox.MousePosition.X()

shtY = EamonnsPicBox.MousePosition.Y()

strLocation = "(" & Str(shtX) & "," & Str(shtY) & ")"

EamonnsPicBox.CreateGraphics.DrawString(strLocation, MyFont, myBrush, 100, 100)

Page 19: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim MyFont = New Font("Arial", 46)

Dim shtX, shtY As Short

Dim strLocation As String

shtX = EamonnsPicBox.MousePosition.X()

shtY = EamonnsPicBox.MousePosition.Y()

strLocation = "(" & Str(shtX) & "," & Str(shtY) & ")"

EamonnsPicBox.CreateGraphics.DrawString(strLocation, MyFont, myBrush, shtX, shtY)

Page 20: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim myBrush As New SolidBrush(Color.Yellow)

EamonnsPicBox.CreateGraphics.DrawRectangle(Pens.Black, 300, 100, 50, 50)

EamonnsPicBox.CreateGraphics.FillRectangle(myBrush, 300, 100, 50, 50)

myBrush.Color = Color.Red

EamonnsPicBox.CreateGraphics.DrawRectangle(Pens.Black, 400, 100, 50, 50)

EamonnsPicBox.CreateGraphics.FillRectangle(myBrush, 400, 100, 50, 50)

Page 21: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim shtX As Short

shtX = EamonnsPicBox.MousePosition.X()

If shtX < 350 Then

EamonnsPicBox.BackColor = Color.Yellow

Else

EamonnsPicBox.BackColor = Color.Red

End If Dim myBrush As New SolidBrush(Color.Yellow)

EamonnsPicBox.CreateGraphics.DrawRectangle(Pens.Black, 300, 100, 50, 50)

EamonnsPicBox.CreateGraphics.FillRectangle(myBrush, 300, 100, 50, 50)

myBrush.Color = Color.Red

EamonnsPicBox.CreateGraphics.DrawRectangle(Pens.Black, 400, 100, 50, 50)

EamonnsPicBox.CreateGraphics.FillRectangle(myBrush, 400, 100, 50, 50)

Page 22: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim Top As New Point(200, 30)

Dim Right As New Point(250, 75)

Dim Bottom As New Point(200, 200)

Dim Left As New Point(150, 75)

Dim myKite As Point() = {Top, Right, Bottom, Left}

EamonnsPicBox.CreateGraphics.FillPolygon(myBrush, myKite)

Point(200, 30)

Point(250, 75)

Point(200, 200)

Point(150, 75)

Page 23: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim myBrush As New SolidBrush(Color.Yellow)

Dim lngI, lngYoffset As Long

For lngI = -300 To 300

lngYoffset = Int((lngI * lngI) / 500)

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 320 + lngI, 50 + lngYoffset, 5, 5)

Sleep(20)

Next lngI

Page 24: Dim  MyBrush As  New  SolidBrush(Color.Black)

Dim myBrush As New SolidBrush(Color.Yellow)

Dim lngI, lngYoffset As Long

For lngI = -300 To 300

lngYoffset = Int((lngI * lngI) / 500)

myBrush.Color = Color.Yellow

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 320 + lngI, 50 + lngYoffset, 15, 15)

Sleep(5)

myBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 320 + lngI, 50 + lngYoffset, 15, 15) Next lngI

Demo Seven

Page 25: Dim  MyBrush As  New  SolidBrush(Color.Black)

For lngI = -200 To 200

lngYoffset = Int((lngI * lngI) / 500)

myBrush.Color = Color.Yellow

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 320 + lngI, 50 + lngYoffset, 15, 15)

Sleep(5)

myBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 320 + lngI, 50 + lngYoffset, 15, 15)

Next lngI

For lngI = -200 To 200

lngYoffset = Int((lngI * lngI) / 500)

myBrush.Color = Color.Yellow

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 400 + 320 + lngI, 50 + lngYoffset, 15, 15)

Sleep(5)

myBrush.Color = Color.Black

EamonnsPicBox.CreateGraphics.FillEllipse(myBrush, 400 + 320 + lngI, 50 + lngYoffset, 15, 15)

Next lngI

Demo eight

Page 26: Dim  MyBrush As  New  SolidBrush(Color.Black)

Private Function mySleep(ByVal intValue As Integer) As Integer

Dim lngWasteTime As Long

For lngWasteTime = 0 To intValue * 10000 ' Waste some time

Next lngWasteTime

End Function

The Sleep function I have been using will not work for you! (in the lab)

You can use mySleep…

Page 27: Dim  MyBrush As  New  SolidBrush(Color.Black)

Animation HintsAnimation Hints

Don’t try to move large amounts of graphics, it will cause flicker.

Play with the examples I have given you, go home, think about it, then plan your animation, then code it.

Simple ideas work best.