Free Windows 8 Metro Style Template for Visual Basic 2010 users

While working on an update to an app for Windows 8, I decided to put together the following template for users to use who may still be using VB.Net 2010.

As someone who is still learning how to use the Visual Studio Tools included with the Windows 8 Developer Build, I am still writing applications using VB.Net 2008/2010 and thought this might be useful if anyone would like to spruce up their applications a little bit. 

 

You can download the Template already pre-done at the bottom of the page.

Start a new Blank Project in VB.net (I am using VB.Net Express 2010 for this Template)

Add 2 Forms to the project. Label them as splash and main and set both to FormBorderStyle None, WindowState Maximized. (I set both to not show in Taskbar and no Text but this is just a preference for me).

Set splash backcolor to 43, 186, 255, main backcolor to white. Set all font colors for all controls to white.

On the splash form add the following controls:

  • Panel named pnllogo. pnllogo backcolor to  43, 186, 255. On pnllogo add the following controls:
  1. picturebox named piclogo, sized 200×200
  2. label named lbllogo, Font Style Segeo UI Light, Light, 48
  3. label named lblcompany, Font Style Segeo UI Light, Light, 28
  • Timer named tmrdisplay with Interval set to 5000

On the main form add the following control:

  • Panel named pnlappbar. pnlappbar backcolor to black. On the pnlappbar add the following controls:
  1. Button named btnapply, Text to display is Apply: Font Style Segeo UI Light, Light, 12: Button size 120×45
  2. Button named btnclose, Text to display is Close: Font Style Segeo UI Light, Light, 12: Button size 120×45
  3. Button named btnyes, Text to display is Yes: Font Style Segeo UI Light, Light, 12: Button size 120×45
  4. Button named btnno, Text to display is No: Font Style Segeo UI Light, Light, 12: Button size 120×45
  5. Label named lblinfo, Font Style Segeo UI Light, Light, 12
  6. Label named lblinfo2, Font Style Segeo UI Light, Light, 12

Add the following code to splash:

Private Sub splash_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        ‘Set Splash Screen size and begin the Timer
        Me.WindowState = FormWindowState.Maximized
        pnllogo.Left = (Me.Width – pnllogo.Width) / 2
        pnllogo.Top = (Me.Height – pnllogo.Height) / 2
        tmrdisplay.Enabled = True
    End Sub
    Private Sub tmrdisplay_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrdisplay.Tick
        ‘Removes the Splash Screen and displays the Main Application
        Me.Visible = False
        main.Visible = True
    End Sub

 

Add the following code to main:

 

#Region “Set Form”
Private Sub main_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        setcontrols()
    End Sub

    Public Sub setcontrols()
        ‘Sets the location for all of the controls on the form.
        pnlappbar.Width = Me.Width
        pnlappbar.Left = Me.Left
        pnlappbar.Height = 100
        pnlappbar.Top = Me.Height – pnlappbar.Height
        btnclose.Left = (pnlappbar.Width – btnclose.Width) – 10
        btnapply.Left = (btnclose.Left – btnclose.Width) – 10
        btnyes.Left = btnapply.Left
        btnyes.Top = btnapply.Top
        btnyes.Visible = False
        btnno.Left = btnclose.Left
        btnno.Top = btnclose.Top
        btnno.Visible = False
        lblinfo.Left = Me.Left + 200
        lblinfo.Visible = False
        lblinfo.Visible = False
        lblinfo2.Left = Me.Left + 200
        lblinfo2.Visible = False
        Me.TopMost = True
    End Sub

    Private Sub main_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
        ‘Make sure application exits.
        Application.Exit()
    End Sub
#End Region ‘Set Form

#Region “Apply Button”
    Private Sub btnapply_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnapply.Click
        ‘Sets the messages across the appbar and displays the correct buttons.
        lblinfo.Visible = False
        btnapply.Visible = False
        btnyes.Visible = True
        btnno.Visible = True
        btnclose.Visible = False
        lblinfo2.Visible = True
        lblinfo2.Text = “Changes you made may require a System Restart. Would you like to Restart Now?”
    End Sub

    Private Sub btnapply_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnapply.MouseEnter
        ‘Sets the messages across the appbar and displays the correct buttons.
        btnapply.BackColor = Color.Gray
        lblinfo.Text = “Apply changes you have made to Windows 8”
        lblinfo.Visible = True
    End Sub

    Private Sub btnapply_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnapply.MouseLeave
        btnapply.BackColor = Color.Black
        lblinfo.Visible = False
    End Sub
#End Region ‘Apply Button

#Region “Close Button”
Private Sub btnclose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnclose.Click
        ‘Exit Application
        Application.Exit()
    End Sub

    Private Sub btnclose_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclose.MouseEnter
        ‘Sets the messages across the appbar and displays the correct buttons.
        btnclose.BackColor = Color.Gray
        lblinfo.Text = “Close the application without making changes?”
        lblinfo.Visible = True
    End Sub

    Private Sub btnclose_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnclose.MouseLeave
        btnclose.BackColor = Color.Black
        lblinfo.Visible = False
    End Sub
#End Region ‘Close Button

#Region “No Button”
Private Sub btnno_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnno.Click
‘Apply your settings
‘We are going to do something here
‘———————————————————
‘Sets the messages across the appbar and displays the correct buttons.
        lblinfo.Visible = False
        btnapply.Visible = True
        btnyes.Visible = False
        btnno.Visible = False
        btnclose.Visible = True
        lblinfo2.Visible = False
End Sub

    Private Sub btnno_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnno.MouseEnter
        btnno.BackColor = Color.Gray
    End Sub

Private Sub btnno_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnno.MouseLeave
        btnno.BackColor = Color.Black
    End Sub
#End Region ‘No Button

#Region “Yes Button”
Private Sub btnyes_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnyes.Click
        ‘Apply your settings
        ‘We are going to do something here
        ‘———————————————————
        ‘This code will Restart Windows
        System.Diagnostics.Process.Start(“shutdown”, “-r -t 05”)
        Application.Exit()
    End Sub

    Private Sub btnyes_MouseEnter(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnyes.MouseEnter
        btnyes.BackColor = Color.Gray
    End Sub

    Private Sub btnyes_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnyes.MouseLeave
        btnyes.BackColor = Color.Black
    End Sub
#End Region ‘Yes Button

Let me know if you need any help.

Download: Windows 8 Metro Style Template for Visual Basic 2010 users.

Cheers! 🙂

Posted by on , in Category Downloads with Tags

The author, Lee Whittington, loves to use his learned talents to write software as a hobby. He also also enjoys playing with Photoshop and is a serious Windows, Software, Gadgets & a Tech news buff. Lee has studied Visual Basic, C++ and Networking.