hics
Using
VB .Net
Contents
• Objective
• Introduction
• Graphics
• Animation
• Net Frame Work
• VB .Net
• Introduction
• How to create graphics in VB .net?
• Classes
• Methods
• Program
• How Animation is generated?
• Timer control
• Programs
• Advantages of VB .Net animation
feature.
• References
• Objective:
VB.Net is a unique language based on Microsoft .Net
Framework. VB.Net has a healing power for Visual Basic
deficiencies and robustness to build advance application
including quality websites. It is gaining popularity due to its
excellent abilities. The number of inbuilt classes in .Net Base
Class Library is so vast that it makes many tough and time
consuming jobs in simple few code steps. Hence there is no
need to write additional code for common routine programs and
behaviours.
• Uses:
• Animation:
• Animation is the rapid display of a sequence of images of
2-D or 3-D artwork or model positions in order to create an
illusion of movement.
10101010
MSIL/IL/CIL:
CLR
CTS
CLS
• Feature
Development
FCL
tool
Application.exe
Application.exe
JIT Compiler
Object
Code
CLR
FCL
OS and Hardware
•VB .Net
• VB .Net is a fully object orient programming
Language (VB7.0, VB7.1, VB8.0, VB9.0, VB10.0 or
VBx) all these are versions of VB .Net.
DrawEllipse()
DrawString()
DrawLine()
DrawIcon()
DrawImage()
FillRectangle()
FillEllipse()
Dim a As Graphics
Dim c1 As Image = Image.FromFile("E:\gcar1.jpg")
Dim s As Image = Image.FromFile("E:\sun.jpg")
Dim g As Image = Image.FromFile("E:\graphic2.png")
Dim h1 As Image = Image.FromFile("E:\house1.gif")
Dim h2 As Image = Image.FromFile("E:\house2.gif")
Dim c2 As Image = Image.FromFile("E:\car2.gif")
Dim f As New Font("Arial", 20, FontStyle.Italic)
a = Me.CreateGraphics
Output:
How to generate animation?
TICK()
' Do it.
Select Case m_Action
Case ActionType.actRun
' Normal screen saver.
Dim canvas As New frmCanvas
Application.Run(canvas)
Case ActionType.actConfigure
' Configure.
Dim dlg_config As New frmConfig
Application.Run(dlg_config)
Case ActionType.actPreview
' Preview.
Dim canvas As New frmCanvas
SetForm(canvas, args(1))
Application.Run(canvas)
End Select
End Sub
With frm
.WindowState = FormWindowState.Normal
.FormBorderStyle = FormBorderStyle.None
.Width = r.right
.Height = r.bottom
End With
End Sub
End Sub
#End Region
End Class
Output:
Program using VB .Net creating stick figures performing
action.
Coding:
Code for animate button
Option Strict Off
Option Explicit On
Friend Class Form1
Inherits System.Windows.Forms.Form
Private Istep As Integer
Private MyImage As Bitmap
Private MyGraphic As Graphics
Private Mypen As Pen
Private DelPen As Pen
M.Image = MyImage
End Sub
M.Image = MyImage
End Sub
End Class
M.Image = MyImage
End Sub
M.Image = MyImage
End Sub
End Class
Output:
•Advantages of VB.Net
Animation Feature: