protected void Page_Load(object sender, EventArgs e)
    {
        WebBuilder web = new WebBuilder();
        List<UIFieldDescription> controlDesc = new List<UIFieldDescription>();
        controlDesc.Add(new UIFieldDescription("姓名", "text", "FullName", "FullName"));
        controlDesc.Add(new UIFieldDescription("性别", "select", "Gender", "Gender"));
        controlDesc.Add(new UIFieldDescription("住址", "text", "Address", "Address"));
        controlDesc.Add(new UIFieldDescription("Age", "text", "Age", "Age"));
        controlDesc.Add(new UIFieldDescription("Email", "text", "Email", "Email"));

        UIDirector director = new UIDirector(web);
        director.Build(controlDesc);

        Panel p = web.GetUI();

        foreach (Control ctl in this.Controls)
        {
            if (ctl is HtmlForm)
            { 
                ctl.Controls.Add(p);
                break;
            }
        }
        
    }
Exemple #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            WinBuilder win = new WinBuilder();
            List<UIFieldDescription> controlDesc = new List<UIFieldDescription>();
            controlDesc.Add(new UIFieldDescription("姓名", "text", "FullName", "FullName"));
            controlDesc.Add(new UIFieldDescription("性别", "select", "Gender", "Gender"));
            controlDesc.Add(new UIFieldDescription("住址", "text", "Address", "Address"));
            controlDesc.Add(new UIFieldDescription("Email", "text", "Email", "Email"));

            UIDirector director = new UIDirector(win);
            director.Build(controlDesc);

            Panel p = win.GetUI();
            p.Height = 400;
            p.Width = 300;
            this.Controls.Add(p);
        }