Text field in custom user control as in the TextBox

1

I'm doing a custom user control.

    public class MiControl:UserControl
    {
       public string _Cadena{get;set;} = "";
       ...
    }

I add it to a windows.forms and in the properties window it shows me this to be able to assign a value to it.

I would like that at design time and when placing myself in this property it will behave as when I place myself in the Text property of a TextBox. It allows me to expand and display a box to include the text more conveniently.

    
asked by ravipe 31.01.2017 в 21:17
source

1 answer

2

The Design Time Attributes for Components that you need add:

    namespace WFATMP1
    {        

        public partial class UserControl1 : UserControl
        {
            [Category("Personalizado")]
            [Description("Propiedad visible en diseño")]
            [Browsable(true)]
[Editor("System.ComponentModel.Design.MultilineStringEditor, System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a", typeof(UITypeEditor))]
            public string Propiedad { get; set; }

            public UserControl1()
            {
                InitializeComponent();
            }
        }
    }

    
answered by 01.02.2017 / 17:27
source