hytos / DTI_PID / SPPIDConverter / Form / SPPIDSplashScreen.cs @ a0965e07
이력 | 보기 | 이력해설 | 다운로드 (2.47 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 | 47ad9a46 | gaqhf | TopMost = true; |
24 | b2d1c1aa | gaqhf | //StartPosition = FormStartPosition.Manual; |
25 | //Location = new Point(0, 0); |
||
26 | ca214bc3 | gaqhf | } |
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 | f31645b6 | gaqhf | if (progressBarControl.Properties.Maximum >= pos) |
38 | progressBarControl.Position = pos; |
||
39 | } |
||
40 | else if (command == SplashScreenCommand.SetStep) |
||
41 | { |
||
42 | string stepText = (string)arg; |
||
43 | d5ec4d0f | gaqhf | labelStep.Text = "Step : " + stepText; |
44 | ca214bc3 | gaqhf | } |
45 | f31645b6 | gaqhf | else if (command == SplashScreenCommand.SetAllStep) |
46 | { |
||
47 | int pos = (int)arg; |
||
48 | progressBarControl.Properties.Maximum = pos; |
||
49 | progressBarControl.Position = 0; |
||
50 | } |
||
51 | d5ec4d0f | gaqhf | else if (command == SplashScreenCommand.SetDocumentName) |
52 | { |
||
53 | string text = (string)arg; |
||
54 | labelDocument.Text = text; |
||
55 | } |
||
56 | f31645b6 | gaqhf | else if (command == SplashScreenCommand.SetParent) |
57 | SetParent(Handle, (IntPtr)arg); |
||
58 | else if (command == SplashScreenCommand.ClearParent) |
||
59 | SetParent(Handle, (IntPtr)0); |
||
60 | ca214bc3 | gaqhf | } |
61 | |||
62 | f31645b6 | gaqhf | [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 | ca214bc3 | gaqhf | #endregion |
68 | |||
69 | public enum SplashScreenCommand |
||
70 | { |
||
71 | SetProgress, |
||
72 | f31645b6 | gaqhf | SetAllStep, |
73 | SetStep, |
||
74 | SetDocumentName, |
||
75 | SetParent, |
||
76 | ClearParent |
||
77 | ca214bc3 | gaqhf | } |
78 | b2d1c1aa | gaqhf | |
79 | |||
80 | ca214bc3 | gaqhf | } |
81 | } |