hytos / DTI_PID / SPPIDConverter / Form / SPPIDSplashScreen.cs @ e248c69e
이력 | 보기 | 이력해설 | 다운로드 (2.41 KB)
1 | ca214bc3 | gaqhf | using System; |
---|---|---|---|
2 | using System.Collections.Generic; |
||
3 | using System.ComponentModel; |
||
4 | using System.Data; |
||
5 | using System.Drawing; |
||
6 | f31645b6 | gaqhf | using System.Runtime.InteropServices; |
7 | ca214bc3 | gaqhf | using System.Text; |
8 | using System.Windows.Forms; |
||
9 | using DevExpress.XtraSplashScreen; |
||
10 | |||
11 | f31645b6 | gaqhf | |
12 | ca214bc3 | gaqhf | namespace Converter.SPPID |
13 | { |
||
14 | public partial class SPPIDSplashScreen : DevExpress.XtraSplashScreen.SplashScreen |
||
15 | { |
||
16 | public SPPIDSplashScreen() |
||
17 | { |
||
18 | InitializeComponent(); |
||
19 | b2d1c1aa | gaqhf | this.labelControl1.Text = "Copyright © 2018-" + DateTime.Now.Year.ToString(); |
20 | } |
||
21 | private void SPPIDSplashScreen_Load(object sender, EventArgs e) |
||
22 | { |
||
23 | b66a2996 | gaqhf | |
24 | ca214bc3 | gaqhf | } |
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 | f31645b6 | gaqhf | if (progressBarControl.Properties.Maximum >= pos) |
36 | progressBarControl.Position = pos; |
||
37 | } |
||
38 | else if (command == SplashScreenCommand.SetStep) |
||
39 | { |
||
40 | string stepText = (string)arg; |
||
41 | d5ec4d0f | gaqhf | labelStep.Text = "Step : " + stepText; |
42 | ca214bc3 | gaqhf | } |
43 | f31645b6 | gaqhf | else if (command == SplashScreenCommand.SetAllStep) |
44 | { |
||
45 | int pos = (int)arg; |
||
46 | progressBarControl.Properties.Maximum = pos; |
||
47 | progressBarControl.Position = 0; |
||
48 | } |
||
49 | d5ec4d0f | gaqhf | else if (command == SplashScreenCommand.SetDocumentName) |
50 | { |
||
51 | string text = (string)arg; |
||
52 | labelDocument.Text = text; |
||
53 | } |
||
54 | f31645b6 | gaqhf | else if (command == SplashScreenCommand.SetParent) |
55 | SetParent(Handle, (IntPtr)arg); |
||
56 | else if (command == SplashScreenCommand.ClearParent) |
||
57 | SetParent(Handle, (IntPtr)0); |
||
58 | 02480ac1 | gaqhf | |
59 | 1ab9a205 | gaqhf | //if (!IsTopMost) |
60 | // this.TopMost = true; |
||
61 | ca214bc3 | gaqhf | } |
62 | |||
63 | f31645b6 | gaqhf | [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 | ca214bc3 | gaqhf | #endregion |
69 | |||
70 | public enum SplashScreenCommand |
||
71 | { |
||
72 | SetProgress, |
||
73 | f31645b6 | gaqhf | SetAllStep, |
74 | SetStep, |
||
75 | SetDocumentName, |
||
76 | SetParent, |
||
77 | ClearParent |
||
78 | ca214bc3 | gaqhf | } |
79 | } |
||
80 | } |