How To Make Scrolling Graphics Effect In VB.NET


hello guys :) this is something very cool and it has been created using pure graphics(2ddrawing) in vb.net . first of all i want to say you don't need work harder to understand the codes because this is created in a very simple format . ok now you see the image in the top of this post and that's how this animation works . you can add more graphics to it if your in to themebase vb.net . first you need to add a timer and i recommend you to make the form border style none for better play .

 here is the codes

Imports System.Drawing.Drawing2D
Public Class Form1

    'Author : Mohamed Shimran
    'Blog : http://www.ultimateprogrammingtutorials.blogspot.com

    Dim g As Graphics = Me.CreateGraphics
    Dim offsetvalue As Integer = 150
    Dim x, y, cx, cy As Integer
    Dim randd As New Random
    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Me.Timer1.Start()
        rota = 10
        x = randd.Next(0, Me.Width)
        y = randd.Next(0, Me.Height)
        cx = randd.Next(5, 10)
        cy = randd.Next(5, 10)
    End Sub
    Dim rota As Integer
    Private Sub Form1_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint
        Dim g As Graphics = e.Graphics
        g.Clear(Color.Green)
        Static angle As Integer
        x += cx
        y += cy
        If x > Me.Width - 150 Then
            cx = -cx
        ElseIf x < 0 Then
            cx = -cx
        End If
        If y > Me.Height - 150 Then
            cy = -cy
        ElseIf y < 0 Then
            cy = -cy
        End If
        Dim G_path As GraphicsPath = New GraphicsPath()
        Dim rectangle As RectangleF = New RectangleF(x, y, 200, 100)
        Dim str_format As StringFormat = New StringFormat()
        str_format.Alignment = StringAlignment.Center
        str_format.LineAlignment = StringAlignment.Center
        G_path.AddRectangle(rectangle)
        G_path.AddString("Ultimate programming tutorials", Me.Font.FontFamily, CInt(Me.Font.Style), Me.Font.Height + 15, rectangle, str_format)
        angle += rota
        If angle > 360 Then
            rota = -rota

        ElseIf angle < 0 Then
            rota = -rota
        End If
        g.DrawPath(New Pen(Brushes.Black, 4), G_path)
        g.FillPath(Brushes.Azure, G_path)
        Dim matrix As Matrix = New Matrix()
        matrix.Translate(0, 0)
        matrix.RotateAt(angle, New PointF(Me.Width / 2 + (50), Me.Height / 2 - (50 / 2)))
        G_path.Transform(matrix)
        g.DrawPath(New Pen(Brushes.White, 4), G_path)
        g.FillPath(Brushes.Black, G_path)
        g.DrawPath(Pens.Black, G_path)
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Invalidate()
    End Sub
End Class


don't do anything for the timer . just tweak the codes for your need and enjoy .

1 comments:

Women in southern regions of India trade it in temples for a token of good luck. Indian temple best hair extensions is healthy, strong, thick, naturally of black color. Sometimes this hair is clip in hair extensions and then dyed a different color, but this process weakens the hair, leaving it dry and brittle. Again, silicone is used to coat the hair, make it shiny, and hide the damage. Long, lace wigs uk is the most sought after, and the most expensive type of Indian hair. European hair is hard to come by, and virgin hair wigs uk the most expensive option. This type is fine, soft and strong. However, since Europe is ethnically a very diverse place, so the lace wigs uk from various countries differs. Russian hair is often considered the highest quality because it is typically very soft and fine, and not treated chemically. In recent times, South America has become an exporter of good quality, hair wigs sale. Brazilian hair has quickly become popular thanks to its strength, body and versatility. When a woman makes the decision to buy blonde wigs london, she may be certain that they will last approximately 12 months with the proper care. Although quality human hair wigs cheap are fashioned from the most beautiful and high quality hair in the world, there will be several procedures a woman will need to follow in order to maximize the lifespan of her lace front wigs cheap. First and foremost, she will need to ensure that she uses the lace wigs human hair to care for the hair. This list of products include shampoo, conditioner and heat protectant spray.

Reply

Post a Comment

Note: Only a member of this blog may post a comment.