1
// ------------------------------------------------------------------
2 // Copyright (C) 2016 Maruko Toolbox Project
6 // Licensed under the Apache License, Version 2.0 (the "License");
7 // you may not use this file except in compliance with the License.
8 // You may obtain a copy of the License at
10 // http://www.apache.org/licenses/LICENSE-2.0
12 // Unless required by applicable law or agreed to in writing, software
13 // distributed under the License is distributed on an "AS IS" BASIS,
14 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
15 // express or implied.
16 // See the License for the specific language governing permissions
17 // and limitations under the License.
18 // -------------------------------------------------------------------
22 using System
.Collections
.Generic
;
23 using System
.ComponentModel
;
28 using System
.Windows
.Forms
;
32 public partial class InputBox
: Form
36 InitializeComponent();
39 private void qqButton1_Click(object sender
, EventArgs e
)
41 DialogResult
= DialogResult
.OK
;
45 private void btnCancel_Click(object sender
, EventArgs e
)
47 DialogResult
= DialogResult
.Cancel
;
51 internal static string Show(string message
, string title
, string text
)
53 using (InputBox inbox
= new InputBox())
55 inbox
.lblMessage
.Text
= message
;
56 inbox
.text
.Text
= text
;
58 if (inbox
.ShowDialog() == DialogResult
.OK
)
59 return inbox
.text
.Text
;
64 private void text_KeyPress(object sender
, KeyPressEventArgs e
)
68 qqButton1_Click(null, null);
70 else if (e
.KeyChar
== 27)
72 btnCancel_Click(null, null);