示例#1
0
 public async void InitializeControls(Control.ControlCollection controls)
 {
     foreach (Control ctrl in controls)
     {
         string dataMember = GetProperty.GetPropertyStringValue(ctrl, Customs.cstDataMember);
         if (!string.IsNullOrWhiteSpace(dataMember))
         {
             InitializeControl(ctrl);
             if (ctrl.Controls.Count > 0)
             {
                 InitializeControls(ctrl.Controls);
             }
         }
     }
 }
        public static FieldControl GetValueJsonForList(System.Windows.Forms.Control.ControlCollection Control)
        {
            FieldControl           _file = new FieldControl();
            List <PropertyControl> propertyControlList = new List <PropertyControl>();

            foreach (System.Windows.Forms.Control p in Control)
            {
                propertyControlList.Add(new PropertyControl
                {
                    TypeName   = p.GetType().ToString(),
                    LocationX  = p.Location.X,
                    LocationY  = p.Location.Y,
                    SizeWidth  = p.Width,
                    SizeHeight = p.Height,
                    Text       = p.Text.ToString(),
                    FontName   = FontToString(p.Font),
                    //picImage = GetImages(p),
                    BackColor = p.BackColor.Name,
                    ForeColor = p.ForeColor.Name,
                    Name      = p.Name,
                    //CntrlssendtoType = "",
                    GGDataSource    = GetProperty.GetPropertyStringValue(p, Customs.cstDataSource),
                    GGDataMember    = GetProperty.GetPropertyStringValue(p, Customs.cstDataMember),
                    GGFieldGroup    = GetProperty.GetPropertyStringValue(p, Customs.cstFieldGroup),
                    GGFieldRelation = GetProperty.GetPropertyStringValue(p, Customs.cstFieldRelation),
                });
            }
            _file = new FieldControl
            {
                id              = Guid.NewGuid().ToString(),
                name            = "ToanCauXanh",
                key             = "",
                description     = "thietkeui",
                version         = "1.0.0",
                lastUpdatedBy   = "hieunguyen",
                lastUpdated     = DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss"),
                propertyControl = propertyControlList
            };
            return(_file);
        }