1 // Copyright 2001-2019 Crytek GmbH / Crytek Group. All rights reserved.
4 using System
.Collections
.Generic
;
8 using System
.Windows
.Forms
;
14 public static DialogResult
Show(string title
, string promptText
, ref string value)
16 Form form
= new Form();
17 Label label
= new Label();
18 TextBox textBox
= new TextBox();
19 Button buttonOk
= new Button();
20 Button buttonCancel
= new Button();
23 label
.Text
= promptText
;
27 buttonCancel
.Text
= "Cancel";
28 buttonOk
.DialogResult
= DialogResult
.OK
;
29 buttonCancel
.DialogResult
= DialogResult
.Cancel
;
31 label
.SetBounds(9, 20, 372, 13);
32 textBox
.SetBounds(12, 36, 372, 20);
33 buttonOk
.SetBounds(228, 72, 75, 23);
34 buttonCancel
.SetBounds(309, 72, 75, 23);
36 label
.AutoSize
= true;
37 textBox
.Anchor
= textBox
.Anchor
| AnchorStyles
.Right
;
38 buttonOk
.Anchor
= AnchorStyles
.Bottom
| AnchorStyles
.Right
;
39 buttonCancel
.Anchor
= AnchorStyles
.Bottom
| AnchorStyles
.Right
;
41 form
.ClientSize
= new Size(396, 107);
42 form
.Controls
.AddRange(new Control
[] { label, textBox, buttonOk, buttonCancel }
);
43 form
.ClientSize
= new Size(Math
.Max(300, label
.Right
+ 10), form
.ClientSize
.Height
);
44 form
.FormBorderStyle
= FormBorderStyle
.FixedDialog
;
45 form
.StartPosition
= FormStartPosition
.CenterScreen
;
46 form
.MinimizeBox
= false;
47 form
.MaximizeBox
= false;
48 form
.AcceptButton
= buttonOk
;
49 form
.CancelButton
= buttonCancel
;
50 DialogResult dialogResult
= form
.ShowDialog();