hytos / DTI_PID / SPPIDConverter / Form / SPPIDSplashScreen.cs @ e248c69e
이력 | 보기 | 이력해설 | 다운로드 (2.41 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 |
|
24 |
} |
25 |
|
26 |
#region Overrides |
27 |
|
28 |
public override void ProcessCommand(Enum cmd, object arg) |
29 |
{ |
30 |
base.ProcessCommand(cmd, arg); |
31 |
SplashScreenCommand command = (SplashScreenCommand)cmd; |
32 |
if (command == SplashScreenCommand.SetProgress) |
33 |
{ |
34 |
int pos = (int)arg; |
35 |
if (progressBarControl.Properties.Maximum >= pos) |
36 |
progressBarControl.Position = pos; |
37 |
} |
38 |
else if (command == SplashScreenCommand.SetStep) |
39 |
{ |
40 |
string stepText = (string)arg; |
41 |
labelStep.Text = "Step : " + stepText; |
42 |
} |
43 |
else if (command == SplashScreenCommand.SetAllStep) |
44 |
{ |
45 |
int pos = (int)arg; |
46 |
progressBarControl.Properties.Maximum = pos; |
47 |
progressBarControl.Position = 0; |
48 |
} |
49 |
else if (command == SplashScreenCommand.SetDocumentName) |
50 |
{ |
51 |
string text = (string)arg; |
52 |
labelDocument.Text = text; |
53 |
} |
54 |
else if (command == SplashScreenCommand.SetParent) |
55 |
SetParent(Handle, (IntPtr)arg); |
56 |
else if (command == SplashScreenCommand.ClearParent) |
57 |
SetParent(Handle, (IntPtr)0); |
58 |
|
59 |
//if (!IsTopMost) |
60 |
// this.TopMost = true; |
61 |
} |
62 |
|
63 |
[DllImport("user32.dll", SetLastError = true)] |
64 |
static extern IntPtr SetParent(IntPtr hWndChild, IntPtr hWndNewParent); |
65 |
[DllImport("user32")] |
66 |
public static extern int GetParent(IntPtr hwnd); |
67 |
|
68 |
#endregion |
69 |
|
70 |
public enum SplashScreenCommand |
71 |
{ |
72 |
SetProgress, |
73 |
SetAllStep, |
74 |
SetStep, |
75 |
SetDocumentName, |
76 |
SetParent, |
77 |
ClearParent |
78 |
} |
79 |
} |
80 |
} |