Example #1
0
        private void DrawFields(object ObjectElement)
        {
            var properties = ObjectElement.GetType().GetProperties();

            foreach (var PropertyElement in properties)
            {
                if ((PropertyElement.PropertyType.IsClass) && (PropertyElement.PropertyType != typeof(String)))
                {
                    DrawFields(PropertyElement.GetValue(ObjectElement));
                }
                else
                {
                    TextBox txtBox = new TextBox();
                    txtBox.Font    = new Font("Calibri", 14, FontStyle.Regular);
                    txtBox.Width   = 550;
                    txtBox.Visible = true;
                    txtBox.Enabled = false;
                    txtBox.Name    = ObjectElement.GetType().Name + "_TextBox";
                    txtBox.Text   += (PropertyElement.Name.ToString() + " = " + PropertyElement.GetValue(ObjectElement).ToString());
                    InfoObjects_flowLayoutPanel.Controls.Add(txtBox);
                }
            }
        }