/// <summary>
 /// Создать поля ввода в зависимости от типа класса.
 /// Так один вход поле соответствует классу имущества.
 /// </summary>
 /// <typeparam name="Type">The type which should be filled with information.</typeparam>
 public void GenListTextLabels(Type rowtype)
 {
     TypeConverter[] column_convert = rowtype.GetProperties()
         .Select(prop => TypeDescriptor.GetConverter(prop.PropertyType)).ToArray();
     PropertyInfo[] row_properties = rowtype.GetProperties();
     // now generate the actual controls
     var template_input = this.editorTextBox_Template;
     for (int i = 0; i < row_properties.Count(); i++)
     {
         var txtbox = new EditorTextBox();
         txtbox.Location = new Point(template_input.Location.X
             , template_input.Location.Y + template_input.Height * i);
         txtbox.Size = template_input.Size;
         var prop_type_str = row_properties[i].PropertyType.ToString().Split('.').Last();
         txtbox.Label = row_properties[i].Name + ": " + prop_type_str;
         txtbox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
         TextInputs.Add(txtbox);
     }
     // add created controls to this form.
     this.Controls.AddRange(TextInputs.ToArray());
 }
示例#2
0
        /// <summary>
        /// Создать поля ввода в зависимости от типа класса.
        /// Так один вход поле соответствует классу имущества.
        /// </summary>
        /// <typeparam name="Type">The type which should be filled with information.</typeparam>
        public void GenListTextLabels(Type rowtype)
        {
            TypeConverter[] column_convert = rowtype.GetProperties()
                                             .Select(prop => TypeDescriptor.GetConverter(prop.PropertyType)).ToArray();
            PropertyInfo[] row_properties = rowtype.GetProperties();
            // now generate the actual controls
            var template_input = this.editorTextBox_Template;

            for (int i = 0; i < row_properties.Count(); i++)
            {
                var txtbox = new EditorTextBox();
                txtbox.Location = new Point(template_input.Location.X
                                            , template_input.Location.Y + template_input.Height * i);
                txtbox.Size = template_input.Size;
                var prop_type_str = row_properties[i].PropertyType.ToString().Split('.').Last();
                txtbox.Label  = row_properties[i].Name + ": " + prop_type_str;
                txtbox.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
                TextInputs.Add(txtbox);
            }
            // add created controls to this form.
            this.Controls.AddRange(TextInputs.ToArray());
        }