-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathFormSplashScreen.cs
More file actions
70 lines (54 loc) · 1.6 KB
/
FormSplashScreen.cs
File metadata and controls
70 lines (54 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace BrainStorm
// for threading method: https://stackoverflow.com/questions/15836027/c-sharp-winform-loading-screen/15836105#15836105
{
public partial class FormSplashScreen : Form
{
private Timer tmr { get; set; }
private int toWait = 4;
//Delegate for cross thread call to close
private delegate void CloseDelegate();
//The type of form to be displayed as the splash screen.
private static FormSplashScreen splashForm;
public FormSplashScreen()
{
InitializeComponent();
tboxTitle.Text = "Brain Storm";
}
private void FormSplashScreen_Shown(object sender, EventArgs e)
{
tmr = new Timer();
//set time interval 3 sec
tmr.Interval = 1000;
//starts the timer
tmr.Start();
tmr.Tick += tmrTick;
}
void tmrTick(object sender, EventArgs e)
{
pbarSplash.Increment(1);
pbarSplash.Maximum = toWait;
if (pbarSplash.Value == toWait)
{
tmr.Stop();
CloseForm();
}
}
void CloseForm()
{
//display mainform
BrainStorm0 mf = new BrainStorm0();
mf.Show();
this.Hide();
}
}
}