VB.NET: Membuat Splash Form


Splash Screen adalah form yang ditampilkan diawal program dijalankan. Fungsinya bisa beragam namun secara garis besar dapat dibagi menjadi 3:
  • Sebagai penghibur user ketika menunggu loading data/setting program yang lama.
  • Berfungsi untuk estetika yang menujukan identitas program saja, tanpa fungsi lainnya.
  • Gabungan kedua fungsi diatas.
Hampir sama seperti menambah form, untuk menambahkan sebuah Splash Screen klik kanan pada project di Solution Explorer kemudian pilih Add -> New Item...

Pilih Common Items, Splash Screen, lalu berinama dan klik tombol Add.

Sebuah template splash screen akan ditambahkan.

Selain UI, code dibelakang form juga ter-generate secara otomatis:
Public NotInheritable Class frmSplashScreen

 'TODO: This form can easily be set as the splash screen
 'for the application by going to the "Application" tab
 'of the Project Designer ("Properties" under the "Project" menu).



 Private Sub frmSplashScreen_Load(ByVal sender As Object, _
         ByVal e As System.EventArgs) Handles Me.Load
     'Set up the dialog text at runtime according to the
     'Application() 's assembly information. 


     'TODO: Customize the application's assembly information
     'in the "Application" pane of the project
     'properties dialog (under the "Project" menu).

     'Application title

     If My.Application.Info.Title <> "" Then
         ApplicationTitle.Text = My.Application.Info.Title
     Else
         'If the application title is missing, use the
         'application name, without the extension

         ApplicationTitle.Text = _
         System.IO.Path.GetFileNameWithoutExtension( _
         My.Application.Info.AssemblyName)
     End If

     'Format the version information using the text set into
     '  the Version control at design time as the
     '  formatting string.  This allows for effective
     '  localization if desired.
     '  Build and revision information could be
     'included by using the following code and changing the
     '  Version control's designtime text to
     '  "Version {0}.{1:00}.{2}.{3}" or something similar.  See
     '  String.Format() in Help for more information.
     '
     '    Version.Text = System.String.Format(Version.Text,
     'My.Application.Info.Version.Major,

     ' My.Application.Info.Version.Minor,
     'My.Application.Info.Version.Build, 

     'My.Application.Info.Version.Revision)

     Version.Text = System.String.Format(Version.Text, _
                       My.Application.Info.Version.Major, _
                       My.Application.Info.Version.Minor)

     'Copyright info
     Copyright.Text = My.Application.Info.Copyright
 End Sub

End Class


Artikel Selanjutnya:
Memilih Form (Splash Screen) menjadi form StartUp.

Click here if you like this article.



Post a Comment

0 Comments