hytos / DTI_PID / SPPIDConverter / Form / SPPIDSplashScreen.cs @ a0965e07
이력 | 보기 | 이력해설 | 다운로드 (2.47 KB)
1 |
using System; |
---|---|
2 |
using System.Collections.Generic; |
3 |
using System.ComponentModel; |
4 |
using System.Data; |
5 |
using System.Drawing; |
6 |
using System.Runtime.InteropServices; |
7 |
using System.Text; |
8 |
using System.Windows.Forms; |
9 |
using DevExpress.XtraSplashScreen; |
10 |
|
11 |
|
12 |
namespace Converter.SPPID |
13 |
{ |
14 |
public partial class SPPIDSplashScreen : DevExpress.XtraSplashScreen.SplashScreen |
15 |
{ |
16 |
public SPPIDSplashScreen() |
17 |
{ |
18 |
InitializeComponent(); |
19 |
this.labelControl1.Text = "Copyright © 2018-" + DateTime.Now.Year.ToString(); |
20 |
} |
21 |
private void SPPIDSplashScreen_Load(object sender, EventArgs e) |
22 |
{ |
23 |
TopMost = true; |
24 |
//StartPosition = FormStartPosition.Manual; |
25 |
//Location = new Point(0, 0); |
26 |
} |
27 |
|
28 |
#region Overrides |
29 |
|
30 |
public override void ProcessCommand(Enum cmd, object arg) |
31 |
{ |
32 |
base.ProcessCommand(cmd, arg); |
33 |
SplashScreenCommand command = (SplashScreenCommand)cmd; |
34 |
if (command == SplashScreenCommand.SetProgress) |
35 |
{ |
36 |
int pos = (int)arg; |
37 |
if (progressBarControl.Properties.Maximum >= pos) |
38 |
progressBarControl.Position = pos; |
39 |
} |
40 |
else if (command == SplashScreenCommand.SetStep) |
41 |
{ |
42 |
string stepText = (string)arg; |
43 |
labelStep.Text = "Step : " + stepText; |
44 |
} |
45 |
else if (command == SplashScreenCommand.SetAllStep) |
46 |
{ |
47 |
int pos = (int)arg; |
48 |
progressBarControl.Properties.Maximum = pos; |
49 |
progressBarControl.Position = 0; |
50 |
} |
51 |
else if (command == SplashScreenCommand.SetDocumentName) |
52 |
{ |
53 |
string text = (string)arg; |
54 |
labelDocument.Text = text; |
55 |
} |
56 |
else if (command == SplashScreenCommand.SetParent) |
57 |
SetParent(Handle, (IntPtr)arg); |
58 |
else if (command == SplashScreenCommand.ClearParent) |
59 |
SetParent(Handle, (IntPtr)0); |
60 |
} |
61 |
|
62 |
[DllImport("user32.dll", SetLastError = true)] |
63 |
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); |
64 |
[DllImport("user32")] |
65 |
public static extern int GetParent(IntPtr hwnd); |
66 |
|
67 |
#endregion |
68 |
|
69 |
public enum SplashScreenCommand |
70 |
{ |
71 |
SetProgress, |
72 |
SetAllStep, |
73 |
SetStep, |
74 |
SetDocumentName, |
75 |
SetParent, |
76 |
ClearParent |
77 |
} |
78 |
|
79 |
|
80 |
} |
81 |
} |