눈 깜빡이기

네크 2014.11.06 20:53:22 *: Imports System.Drawing.Drawing2D

Public Class Form1

Protected eyeImages(4) As Image
Protected currentImage As Integer = 0
Protected animationStep As Integer = 1

Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)

Me.Close()

End Sub

Private Sub frmAnimation_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Fills the image array for the Winking Eye example.
eyeImages(0) = My.Resources.Eye1
eyeImages(1) = My.Resources.Eye2
eyeImages(2) = My.Resources.Eye3
eyeImages(3) = My.Resources.Eye4
End Sub

Private Sub tmrRun_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrRun.Tick

Dim grfx As Graphics = CreateGraphics()
'
grfx.DrawImage(eyeImages(currentImage), 12, 24, eyeImages(currentImage).Width, eyeImages(currentImage).Height)

grfx.Dispose()

currentImage += animationStep
If currentImage = 3 Then

animationStep = -1
ElseIf currentImage = 0 Then

animationStep = 1
End If
End Sub

Private Sub btnRun_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
tmrRun.Interval = 120 - 10 * trbSpeed.Value
tmrRun.Enabled = True
End Sub

Private Sub btnStop_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
tmrRun.Enabled = False
End Sub

Private Sub trbSpeed_Scroll(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles trbSpeed.Scroll
tmrRun.Interval = 120 - 10 * trbSpeed.Value
End Sub

Private Sub frmAnimation_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
Dim grfx As Graphics = CreateGraphics()
grfx.DrawImage(eyeImages(0), 12, 24, eyeImages(currentImage).Width,
eyeImages(currentImage).Height)
End Sub

End Class

눈 깜빡이는 png 파일 4개 찾아주세여..

 

그래픽 바뀌면서 연속 동작 처럼 보여주는 파일 입니다.  

 

20141107-눈깜빡.png