Mega Code Archive

 
Categories / VB.Net Tutorial / GUI
 

A splash screen

Imports System.Windows.Forms Imports System.Drawing Imports System.Drawing.Drawing2D public class SplashScreenDemo    public Shared Sub Main         Application.Run(New Form1)    End Sub End class Public Class Form1     Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         Dim dlg As New dlgSplash()         dlg.ShowSplash()         Me.Show()     End Sub     Private Sub AboutToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AboutToolStripMenuItem.Click         Dim dlg As New dlgSplash()         dlg.ShowAbout()     End Sub End Class <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Public Class Form1     Inherits System.Windows.Forms.Form     'Form overrides dispose to clean up the component list.     <System.Diagnostics.DebuggerNonUserCode()> _     Protected Overrides Sub Dispose(ByVal disposing As Boolean)         If disposing AndAlso components IsNot Nothing Then             components.Dispose()         End If         MyBase.Dispose(disposing)     End Sub     'Required by the Windows Form Designer     Private components As System.ComponentModel.IContainer     'NOTE: The following procedure is required by the Windows Form Designer     'It can be modified using the Windows Form Designer.       'Do not modify it using the code editor.     <System.Diagnostics.DebuggerStepThrough()> _     Private Sub InitializeComponent()         Me.MenuStrip1 = New System.Windows.Forms.MenuStrip         Me.FileToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem         Me.mnuFileExit = New System.Windows.Forms.ToolStripMenuItem         Me.mnuHelpAbout = New System.Windows.Forms.ToolStripMenuItem         Me.AboutToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem         Me.MenuStrip1.SuspendLayout()         Me.SuspendLayout()         '         'MenuStrip1         '         Me.MenuStrip1.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.FileToolStripMenuItem, Me.mnuHelpAbout})         Me.MenuStrip1.Location = New System.Drawing.Point(0, 0)         Me.MenuStrip1.Name = "MenuStrip1"         Me.MenuStrip1.Size = New System.Drawing.Size(292, 24)         Me.MenuStrip1.TabIndex = 1         Me.MenuStrip1.Text = "MenuStrip1"         '         'FileToolStripMenuItem         '         Me.FileToolStripMenuItem.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuFileExit})         Me.FileToolStripMenuItem.Name = "FileToolStripMenuItem"         Me.FileToolStripMenuItem.Size = New System.Drawing.Size(44, 20)         Me.FileToolStripMenuItem.Text = "&File"         '         'mnuFileExit         '         Me.mnuFileExit.Name = "mnuFileExit"         Me.mnuFileExit.Size = New System.Drawing.Size(110, 22)         Me.mnuFileExit.Text = "E&xit"         '         'mnuHelpAbout         '         Me.mnuHelpAbout.DropDownItems.AddRange(New System.Windows.Forms.ToolStripItem() {Me.AboutToolStripMenuItem})         Me.mnuHelpAbout.Name = "mnuHelpAbout"         Me.mnuHelpAbout.Size = New System.Drawing.Size(49, 20)         Me.mnuHelpAbout.Text = "&Help"         '         'AboutToolStripMenuItem         '         Me.AboutToolStripMenuItem.Name = "AboutToolStripMenuItem"         Me.AboutToolStripMenuItem.Size = New System.Drawing.Size(135, 22)         Me.AboutToolStripMenuItem.Text = "&About..."         '         'Form1         '         Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font         Me.ClientSize = New System.Drawing.Size(292, 273)         Me.Controls.Add(Me.MenuStrip1)         Me.Name = "Form1"         Me.Text = "Form1"         Me.MenuStrip1.ResumeLayout(False)         Me.MenuStrip1.PerformLayout()         Me.ResumeLayout(False)         Me.PerformLayout()     End Sub     Friend WithEvents MenuStrip1 As System.Windows.Forms.MenuStrip     Friend WithEvents FileToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem     Friend WithEvents mnuFileExit As System.Windows.Forms.ToolStripMenuItem     Friend WithEvents mnuHelpAbout As System.Windows.Forms.ToolStripMenuItem     Friend WithEvents AboutToolStripMenuItem As System.Windows.Forms.ToolStripMenuItem End Class Public Class dlgSplash     Private Sub dlgSplash_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Me.Paint         Dim bm As Bitmap = new Bitmap("yourfile.jpg")         e.Graphics.DrawImage(bm, New PointF(0, 0))     End Sub     Public Sub ShowSplash()         Me.tmrUnload.Enabled = True         Me.TopMost = True                   Me.Show()                       End Sub     Private Sub tmrUnload_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles tmrUnload.Tick         Me.Close()     End Sub     Public Sub ShowAbout()         btnOK.Visible = True                 Me.ShowDialog()                  End Sub     Private Sub btnOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnOK.Click         Me.Close()     End Sub End Class <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ Partial Public Class dlgSplash     Inherits System.Windows.Forms.Form     'Form overrides dispose to clean up the component list.     <System.Diagnostics.DebuggerNonUserCode()> _     Protected Overrides Sub Dispose(ByVal disposing As Boolean)         If disposing AndAlso components IsNot Nothing Then             components.Dispose()         End If         MyBase.Dispose(disposing)     End Sub     'Required by the Windows Form Designer     Private components As System.ComponentModel.IContainer     'NOTE: The following procedure is required by the Windows Form Designer     'It can be modified using the Windows Form Designer.       'Do not modify it using the code editor.     <System.Diagnostics.DebuggerStepThrough()> _     Private Sub InitializeComponent()         Me.components = New System.ComponentModel.Container         Me.Label3 = New System.Windows.Forms.Label         Me.Label2 = New System.Windows.Forms.Label         Me.Label1 = New System.Windows.Forms.Label         Me.btnOK = New System.Windows.Forms.Button         Me.tmrUnload = New System.Windows.Forms.Timer(Me.components)         Me.SuspendLayout()         '         'Label3         '         Me.Label3.BackColor = System.Drawing.Color.Transparent         Me.Label3.Font = New System.Drawing.Font("Microsoft Sans Serif", 10.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))         Me.Label3.Location = New System.Drawing.Point(16, 120)         Me.Label3.Name = "Label3"         Me.Label3.Size = New System.Drawing.Size(320, 24)         Me.Label3.TabIndex = 7         Me.Label3.Text = "Copyright 2005, "         Me.Label3.TextAlign = System.Drawing.ContentAlignment.MiddleCenter         '         'Label2         '         Me.Label2.BackColor = System.Drawing.Color.Transparent         Me.Label2.Font = New System.Drawing.Font("Microsoft Sans Serif", 13.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))         Me.Label2.Location = New System.Drawing.Point(16, 88)         Me.Label2.Name = "Label2"         Me.Label2.Size = New System.Drawing.Size(320, 24)         Me.Label2.TabIndex = 6         Me.Label2.Text = "Version 1.2.345"         Me.Label2.TextAlign = System.Drawing.ContentAlignment.MiddleCenter         '         'Label1         '         Me.Label1.AutoSize = True         Me.Label1.BackColor = System.Drawing.Color.Transparent         Me.Label1.Font = New System.Drawing.Font("Mistral", 48.0!, CType((System.Drawing.FontStyle.Bold Or System.Drawing.FontStyle.Italic), System.Drawing.FontStyle), System.Drawing.GraphicsUnit.Point, CType(0, Byte))         Me.Label1.Location = New System.Drawing.Point(32, 24)         Me.Label1.Name = "Label1"         Me.Label1.Size = New System.Drawing.Size(295, 76)         Me.Label1.TabIndex = 5         Me.Label1.Text = "www.rntsoft.com"         '         'btnOK         '         Me.btnOK.BackColor = System.Drawing.Color.MediumPurple         Me.btnOK.Location = New System.Drawing.Point(152, 152)         Me.btnOK.Name = "btnOK"         Me.btnOK.Size = New System.Drawing.Size(40, 24)         Me.btnOK.TabIndex = 4         Me.btnOK.Text = "OK"         Me.btnOK.UseVisualStyleBackColor = False         Me.btnOK.Visible = False         '         'tmrUnload         '         Me.tmrUnload.Interval = 3000         '         'dlgSplash         '         Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)         Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font         Me.BackColor = System.Drawing.Color.Magenta         Me.ClientSize = New System.Drawing.Size(354, 221)         Me.Controls.Add(Me.Label3)         Me.Controls.Add(Me.Label2)         Me.Controls.Add(Me.Label1)         Me.Controls.Add(Me.btnOK)         Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None         Me.Name = "dlgSplash"         Me.Text = "dlgSplash"         Me.TransparencyKey = System.Drawing.Color.Magenta         Me.ResumeLayout(False)         Me.PerformLayout()     End Sub     Friend WithEvents Label3 As System.Windows.Forms.Label     Friend WithEvents Label2 As System.Windows.Forms.Label     Friend WithEvents Label1 As System.Windows.Forms.Label     Friend WithEvents btnOK As System.Windows.Forms.Button     Friend WithEvents tmrUnload As System.Windows.Forms.Timer End Class