ホテル管理システム
ogi
yesterday 1a1c8e71fcd14858f595029f089b2d4a00202b32
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
using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Design;
using System.ComponentModel;
using System.Windows.Forms.Design;
using HotelPms.Share.Windows.Component.PropertyDialog;
using System.Windows.Forms;
 
namespace HotelPms.Share.Windows.Component.PropertyEditor
{
    public class InputTypeEditor : UITypeEditor
    {
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            if (context != null && context.Instance != null)
            {
                return UITypeEditorEditStyle.Modal;
            }
 
            return base.GetEditStyle(context);
        }
 
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService editorService = null;
 
            if (context != null && context.Instance != null && provider != null)
            {
                editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
                if (editorService != null)
                {
                    CTextBox control = (CTextBox)context.Instance;
                    using (FormInputType dlg = new FormInputType(control.InputType))
                    {
                        if (dlg.ShowDialog() == DialogResult.OK)
                        {
                            value = dlg.InputType;
                            return value;
                        }
                    }
                }
            }
 
            return value;
        }
    }
}