blob: d8ad0710b312ea7ea4cc8dd41bd0eeea40b8f54c (
plain) (
blame)
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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
|
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Media;
using System.IO;
namespace ShiftOS.Engine.WindowManager
{
public partial class InfoboxTemplate : UserControl
{
Stream _str;
private int _buttonChoice;
private int _buttonSelected;
private int _leftDistance;
private int _rightDistance;
private int _textWidth;
private int _textHeight;
private int _topDistance;
private int _bottomDistance;
public InfoboxTemplate(ButtonType type)
{
InitializeComponent();
switch (type)
{
case ButtonType.Ok:
btnOpt1.Text = "OK";
btnOpt2.Hide();
btnOpt1.Location = new Point(109, 134);
_buttonChoice = 1;
break;
case ButtonType.OkCancel:
btnOpt1.Text = "OK";
btnOpt2.Text = "Cancel";
_buttonChoice = 2;
break;
case ButtonType.YesNo:
btnOpt1.Text = "Yes";
btnOpt2.Text = "No";
_buttonChoice = 3;
break;
}
}
public enum ButtonType
{
YesNo,
OkCancel,
Ok
}
private void btnOpt1_Click(object sender, EventArgs e)
{
switch (btnOpt1.Text)
{
case "OK":
_buttonSelected = 1;
ParentForm?.Close();
break;
case "Yes":
_buttonSelected = 2;
ParentForm?.Close();
break;
}
}
private void btnOpt2_Click(object sender, EventArgs e)
{
switch (btnOpt2.Text)
{
case "No":
_buttonSelected = 3;
break;
case "Cancel":
_buttonSelected = 4;
break;
}
}
public void Play()
{
_str = Properties.Resources.infobox;
SoundPlayer sp = new SoundPlayer(_str);
sp.Play();
sp.Stream.Position = 0;
}
private void InfoboxTemplate_Load(object sender, EventArgs e)
=> Play();
private void changeSize_Tick(object sender, EventArgs e)
{
ChangeSize();
}
private void ChangeSize()
{
_textHeight = label1.Height;
_textWidth = label1.Width;
_topDistance = 55;
_bottomDistance = 121;
_rightDistance = 101;
_leftDistance = 55;
this.Height = _textHeight + _topDistance + _bottomDistance;
this.Width = _textWidth + _leftDistance + _rightDistance;
}
}
}
|