yangyin
2024-10-25 1e65c49ba929103e79d87322ca1a3573c2b532e2
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
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing.Design;
using System.Linq;
using System.Text;
using System.Windows.Forms;
 
namespace DPumpHydr.WinFrmUI.WenSkin.Design.Editor
{
    public class TextEditFormUITypeEditor : UITypeEditor
    {
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            var picker = new EditForm.MultilineTextEditForm(value?.ToString());
            if (picker.ShowDialog() == DialogResult.OK)
            {
                return picker.Message;
            }
            return value;
        }
 
        public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
        {
            return UITypeEditorEditStyle.Modal;
        }
    }
}