zoukankan      html  css  js  c++  java
  • MultiLineTextEditor

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Drawing.Design;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Windows.Forms.Design;

    namespace WindowsFormsApplication1
    {
         public class MultiLineTextEditor : UITypeEditor
         {
             private IWindowsFormsEditorService _editorService;

            public override UITypeEditorEditStyle GetEditStyle(ITypeDescriptorContext context)
             {
                 return UITypeEditorEditStyle.DropDown;
             }

            public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
             {
                 _editorService = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

                TextBox textEditorBox = new TextBox();
                 textEditorBox.Multiline = true;
                 textEditorBox.ScrollBars = ScrollBars.Vertical;
                 textEditorBox.Width = 250;
                 textEditorBox.Height = 150;
                 textEditorBox.BorderStyle = BorderStyle.None;
                 textEditorBox.AcceptsReturn = true;

                textEditorBox.Text = value as string;

                _editorService.DropDownControl(textEditorBox);

                return textEditorBox.Text;

            }

        }


        public class CustomPropertyGrid
         {
             private string multiLineStr = string.Empty;


             public string SingleLineStr { get; set; }

            [Editor(typeof(MultiLineTextEditor), typeof(UITypeEditor))]
             public string MultiLineStr
             {
                 get;
                 set;
             }


         }
    }

  • 相关阅读:
    Ext架构分析(6)最简单的layout:AnchorLayout
    Ext架构分析(4)Container之旅
    ext学习资源汇总
    DomQuery v1.1 高级
    Ext 2.0 教程 目录
    HDOJ2006 ( 求奇数的乘积 ) 【水题】
    HDOJ2017 ( 字符串统计 ) 【水题】
    状态模式(State)
    HDOJ2002 ( 计算球体积 ) 【水题】
    HDOJ2007 ( 平方和与立方和 ) 【水题】
  • 原文地址:https://www.cnblogs.com/atuo/p/8176951.html
Copyright © 2011-2022 走看看