Exemplo n.º 1
0
        public static void GetValueControlByJson(System.Windows.Forms.Control.ControlCollection control, string pathFile)
        {
            control.Clear();
            var fieldControl = Newtonsoft.Json.JsonConvert.DeserializeObject <FieldControl>(File.ReadAllText(pathFile));

            foreach (var p in fieldControl.propertyControl)
            {
                try
                {
                    switch (p.TypeName)
                    {
                        #region GGTextEdit
                    case "GreenGlobal.Qlxdcb.Component.GGTextEdit":
                    {
                        GGTextEdit ctrl = new GGTextEdit();
                        SetControlByProperties(ctrl, p);
                        control.Add(ctrl);
                    }
                    break;
                        #endregion

                        #region GGLabel
                    case "GreenGlobal.Qlxdcb.Component.GGLabel":
                    {
                        GGLabel ctrl = new GGLabel();
                        SetControlByProperties(ctrl, p);
                        control.Add(ctrl);
                    }
                    break;
                        #endregion

                        #region GGComboBase
                    case "GreenGlobal.Qlxdcb.Component.GGComboBase":
                    {
                        GGComboBase ctrl = new GGComboBase();
                        SetControlByProperties(ctrl, p);
                        control.Add(ctrl);
                    }
                    break;
                        #endregion

                        #region GGCheckEdit
                    case "GreenGlobal.Qlxdcb.Component.GGCheckEdit":
                    {
                        GGCheckEdit ctrl = new GGCheckEdit();
                        SetControlByProperties(ctrl, p);
                        control.Add(ctrl);
                    }
                    break;
                        #endregion
                    }
                }
                catch
                {
                }
            }
        }
Exemplo n.º 2
0
        private void LabelTool_Click(object sender, EventArgs e)
        {
            Random rnd        = new Random();
            int    randNumber = rnd.Next(1, 1000);
            String textName   = "lbl_" + randNumber;

            GGLabel ctrl = new GGLabel();

            ctrl.Location = new Point(30, 30);
            ctrl.Name     = textName;
            ctrl.Font     = new System.Drawing.Font("Tahoma", 8F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            ctrl.Text     = "GGLabel";

            ctrl.MouseEnter += new EventHandler(control_MouseEnter);
            ctrl.MouseLeave += new EventHandler(control_MouseLeave);
            ctrl.MouseDown  += new MouseEventHandler(control_MouseDown);
            ctrl.MouseMove  += new MouseEventHandler(control_MouseMove);
            ctrl.MouseUp    += new MouseEventHandler(control_MouseUp);
            pnControls.Controls.Add(ctrl);
        }