Ejemplo n.º 1
1
 protected override void OnPreInit(EventArgs e)
 {
     base.OnPreInit(e);
     _formPanel = new FormPanel();
     _formPanel.BodyPadding = 10;
     _formPanel.Layout = "table";
     _formPanel.LayoutConfig.Add(new TableLayoutConfig()
     {
         Columns = 2
     });
     _formPanel.ID = "addForm";
     _formPanel.DefaultAnchor = "100%";
     _txtUsername = new TextField();
     _txtUsername.ID = "txtUsername";
     _txtUsername.Name = "Username";
     _txtUsername.ColSpan = 1;
     _txtUsername.Width = 300;
     _txtUsername.AllowBlank = false;
     _txtUsername.FieldLabel = "用户名";
     _txtUsername.EmptyText = "输入用户名";
     _formPanel.Add(_txtUsername);
     _comboStatus = new ComboBox();
     _comboStatus.EmptyText = "选择状态";
     _comboStatusStore = new Store();
     _comboStatusStore.ID = "comboStoreStatus";
     _comboStatusStore.Model.Add(ComponentHelper.GetModel(
         new Dictionary<string, ModelFieldType>(){
     {"Id",ModelFieldType.Int},{"Name",ModelFieldType.String}
     }));
     _comboStatus.ValueHiddenName = "Status";
     _comboStatus.SimpleSubmit = true;
     _comboStatus.DisplayField = "Name";
     _comboStatus.ValueField = "Id";
     _comboStatus.Store.Add(_comboStatusStore);
     _comboStatus.FieldLabel = "状态";
     _comboStatus.Editable = false;
     _formPanel.Add(_comboStatus);
     _txtMemo = new TextArea();
     _txtMemo.Width = 750;
     _txtMemo.Name = "Description";
     _txtMemo.ColSpan = 2;
     _txtMemo.FieldLabel = "描述";
     _txtMemo.Height = 80;
     _formPanel.Add(_txtMemo);
     _treeRoleSelector = new TreePanelNodeMover();
     _treeRoleSelector.LeftReadData += _treeRoleSelector_LeftReadData;
     //_treeRoleSelector.RightReadData += _treeRoleSelector_RightReadData;
     _treeRoleSelector.Height = 180;
     _treeRoleSelector.Width = 750;
     _treeRoleSelector.ColSpan = 2;
     _treeRoleSelector.ID = "treeRoles";
     _formPanel.Add(_treeRoleSelector);
     _btnAdd = new Button();
     _btnAdd.Text = "添加";
     _btnAdd.Icon = Icon.Add;
     _btnAdd.DirectEvents.Click.Event += AddUser;
     _btnAdd.DirectEvents.Click.EventMask.Set("正在添加");
     _formPanel.Buttons.Add(_btnAdd);
     MainForm.Controls.Add(_formPanel);
 }
        protected override void OnPreInit(EventArgs e)
        {
            base.OnPreInit(e);
            txtOldPassword = new TextField();
            txtOldPassword.Name = "OldPassword";
            txtOldPassword.ID = "txtOldPassword";
            txtOldPassword.FieldLabel = "旧密码";
            txtOldPassword.InputType = InputType.Password;
            txtNewPassword = new TextField()
            {
                Name = "NewPassword",
                ID = "txtNewPassword",
                InputType = InputType.Password,
                FieldLabel = "新密码"
            };
            txtNewPassword2 = new TextField()
            {
                Name = "NewPassword2",
                ID = "txtNewPassword2",
                InputType = InputType.Password,
                FieldLabel = "确认密码"
            };
            formPanel = new FormPanel();
            formPanel.BodyPadding = 20;
            formPanel.Add(txtOldPassword);
            formPanel.Add(txtNewPassword);
            formPanel.Add(txtNewPassword2);
            Controls.Add(formPanel);

            btnAccept = new Button()
            {
                Icon = Icon.Accept,
                Text = "修改",
                ID = "btnAccept"
            };
            btnAccept.DirectClick += btnAccept_DirectClick;
            btnAccept.DirectEvents.Click.EventMask.Set("正在修改");

            formPanel.Buttons.Add(btnAccept);
        }