- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCustomMessageBox.cs
More file actions
Latest commit
100 lines (86 loc) · 2.89 KB
/
Copy pathCustomMessageBox.cs
File metadata and controls
100 lines (86 loc) · 2.89 KB
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
usingSystem;
usingSystem.Collections.Generic;
usingSystem.ComponentModel;
usingSystem.Data;
usingSystem.Drawing;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Windows.Forms;
/*
* CustomMessageBox
* 터치화면에서 메시지박스 버튼 크기 조절을 위해 다시 만든 메시지 박스 다이얼로그
*/
namespaceCustomMessageBox
{
publicpartialclassCustomMessageBox:Form
{
publicCustomMessageBox()
{
InitializeComponent();
}
publicCustomMessageBox(stringtitle,stringquestion,MessageBoxKindfield)
{
InitializeComponent();
this.Text=title;
this.questionLabel.Text=question;
this.mBoxKind=field;
if(field==MessageBoxKind.Default)
{
confirmButton.Visible=false;
noButton.Visible=false;
cancelButton.Text="확인";
}
elseif(field==MessageBoxKind.YesNo)
{
confirmButton.Visible=true;
noButton.Visible=false;
confirmButton.Text="예";
cancelButton.Text="아니요";
}
else// field == MessageBoxKind.YesNoCancel
{
confirmButton.Visible=true;
noButton.Visible=true;
confirmButton.Text="확인";
cancelButton.Text="취소";
}
// TODO: questionLabel에 한글28자까지 쓰면 다음줄로. <<- 이 기능은 보류. 일단 필요없을듯.
}
publicenumMessageBoxKind
{
Default,YesNo,YesNoCancel
}
publicenumDialogResults
{
No,Yes,Cancel
}
privateMessageBoxKindmBoxKind;
privatestaticDialogResultsresponse;
privatevoidconfirmButton_Click(objectsender,EventArgse)
{
setResponse(DialogResults.Yes);
this.Close();
}
privatevoidNoButton_Click(objectsender,EventArgse)
{
setResponse(DialogResults.No);
this.Close();
}
privatevoidcancelButton_Click(objectsender,EventArgse)
{
if(mBoxKind==MessageBoxKind.YesNo)// YesNo버튼일 때는 No기능 담당. 레이아웃 위치상 noButton을 표시하면 너무 왼쪽으로 쏠리는 느낌이라 cancel버튼으로 no기능 대체함.
setResponse(DialogResults.No);
else// (mBoxKind == MessageBoxKind.YesNoCancel) || (mBoxKind == MessageBoxKind.Default)
setResponse(DialogResults.Cancel);
this.Close();
}
publicvoidsetResponse(DialogResultsres)
{
response=res;
}
publicstaticDialogResultsgetResponse()
{
returnresponse;
}
}
}