tangxu
2024-10-24 c7a67ab24f476b0f8593fc61362d3bb8b262aa3e
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
using DPumpHydr.WinFrmUI.RLT.Child.Crown;
using DPumpHydr.WinFrmUI.RLT.Controls;
using DPumpHydr.WinFrmUI.RLT.Docking.Crown;
using DPumpHydr.WinFrmUI.RLT.Enum.Crown;
using System.Drawing;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.RLT.UI.Forms.Docking
{
    public partial class DockDocument : CrownDocument
    {
        #region Constructor Region
 
        public DockDocument()
        {
            InitializeComponent();
 
            // Workaround to stop the textbox from highlight all text.
            txtDocument.SelectionStart = txtDocument.Text.Length;
 
            // Build dummy dropdown data
            cmbOptions.Items.Add(new CrownDropDownItem("25%"));
            cmbOptions.Items.Add(new CrownDropDownItem("50%"));
            cmbOptions.Items.Add(new CrownDropDownItem("100%"));
            cmbOptions.Items.Add(new CrownDropDownItem("200%"));
            cmbOptions.Items.Add(new CrownDropDownItem("300%"));
            cmbOptions.Items.Add(new CrownDropDownItem("400%"));
        }
 
        public DockDocument(string text, Image icon) : this()
        {
            DockText = text;
            Icon = icon;
        }
 
        #endregion
 
        #region Event Handler Region
 
        public override void Close()
        {
            DialogResult result = CrownMessageBox.ShowWarning(@"You will lose any unsaved changes. Continue?", @"Close document", DialogButton.YesNo);
            if (result == DialogResult.No)
            {
                return;
            }
 
            base.Close();
        }
 
        #endregion
    }
}