Click here to Skip to main content
15,896,437 members
Articles / Desktop Programming / Win32

A Full Yahoo! Weather App, Yes Another One

Rate me:
Please Sign up or sign in to vote.
4.96/5 (29 votes)
16 Apr 2011CPOL8 min read 246.5K   3.9K   110  
Uses Farhad Siasar's YahooWeathertlb library with a few added functions
Public NotInheritable Class SplashScreen1

    Dim radius As Integer = 4


    Private Sub SplashScreen1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        RoundMyCorners()

        Version.Text = "Version : " & My.Application.Info.Version.ToString() & vbCrLf _
        & My.Application.Info.Copyright.ToString & vbCrLf _
        & "Robert S. Percy"

        Me.Cursor = Cursors.WaitCursor
        Me.Status("Please Wait - Retrieving Zip-Code Info...")
    End Sub


    Private Sub RoundMyCorners()
        'Code by RSPercy 02/25/2010
        Dim frmToRnd As System.Windows.Forms.Form = Me
        Dim regionRects(radius * 2 + 2) As System.Drawing.Rectangle
        Dim circle As New Bitmap(radius * 2, radius * 2)
        Dim g As System.Drawing.Graphics = System.Drawing.Graphics.FromImage(circle)

        g.Clear(Color.White)
        g.FillEllipse(Brushes.Black, 0, 0, circle.Width, circle.Height)

        Dim col As Integer = 0
        For row As Integer = 0 To radius - 1
            For col = 0 To radius - 1
                If circle.GetPixel(col, row) <> System.Drawing.Color.FromArgb(255, 255, 255, 255) Then Exit For
            Next
            regionRects(row * 2) = New System.Drawing.Rectangle(col, row, frmToRnd.Width - 2 * col, 1)
            regionRects(row * 2 + 1) = New System.Drawing.Rectangle(col, frmToRnd.Height - row - 1, frmToRnd.Width - 2 * col, 1)
        Next

        regionRects(radius * 2 + 2) = New System.Drawing.Rectangle(0, radius, frmToRnd.Width, frmToRnd.Height - circle.Height)

        Dim myPath As New Drawing2D.GraphicsPath
        myPath.AddRectangles(regionRects)
        frmToRnd.Region = New Region(myPath)

        'Clean Up.
        myPath.Dispose()
        circle.Dispose()
        g.Dispose()
    End Sub


    ' Our declared delegate routine for updating the splash screen on a different thread.
    Private Delegate Sub UpdateStatus(ByVal text As String)


    Private Sub UpdateStatusText(ByVal text As String)
        lblLoading.Text = text
    End Sub


    Public Sub Status(ByVal text As String)
        If Me.Created Then
            lblLoading.Invoke(New UpdateStatus(AddressOf UpdateStatusText), New Object() {text})
        End If
    End Sub


End Class

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Retired
United States United States
I am currently retired.
I have no degree but I have some programming experience
when I was in college(Cobol, Pascal).

My accomplishments thus far are;
Best VB.Net article for January(2009)
Best VB.Net article for July(2009)

Comments and Discussions