Membuat splash screen pada aplikasi dekstop dengan menggunakan bahasa c sharp pada visual studio 2015.
1. Buat form dengan nama Splash dan rancang tampilan splash yang anda inginkan.
Pengaturan properties timer interval 500/100 sama saja 5 detik tampilan splash akan berjalan.
3. Coding didalam form splash
Splash Form
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Threading;
namespace NamProject
{
public partial class Splash : Form
{
public Splash()
{
InitializeComponent();
txtwait.Text = "Please Wait...";
}
public int timerleft
{
get;
set;
}
private void timer1_Tick(object sender, EventArgs e)
{
if (timerleft > 0)
{
timerleft = timerleft - 1;
}
else
{
timer1.Stop();
new Login().Show();//Splash menutup dialihkan ke login form.
this.Hide();
}
}
private void Splash_Load(object sender, EventArgs e)
{
timerleft = 10;
timer1.Start();
}
}
}
4. Edit Application.Run Splash(), fungsi ketika program jalan Form Splash yang pertama muncul.
Program.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace NamaProject
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Splash());
}
}
}
5. Jalankan Program
Comments