Beispiel #1
0
        private void addControl(List<KeyValue> keyvalue)
        {
            if (panel1.InvokeRequired)
            {
                panel1.Invoke(new addControlHandler(addControl), keyvalue);
            }
            else
            {

                panel1.Controls.Clear();
                int top = 0;
                foreach (KeyValue v in keyvalue)
                {
                    if (v.TagType == "password" || v.TagType == "text" || v.TagType == "checkbox")
                    {
                        MyInput input = new MyInput();

                        input.IsCheckbox = v.TagType == "checkbox";
                        input.tagName = v.Key;
                        input.CreateControl();
                        v.inputControl = input;
                        input.Top = top;
                        top += input.Height;
                        addInput(input);

                        if (v.Key == "randCode")
                        {
                            input.txtValue.TextChanged += new EventHandler(loginRand_TextChanged);
                            input.txtValue.Tag = v.getForm();
                        }
                    }
                }
                if (keyvalue != null && keyvalue.Count > 0)
                {
                    Button btnLogin = new Button();
                    btnLogin.Text = "提交";
                    btnLogin.Tag = keyvalue[0].getForm();
                    btnLogin.Click += new EventHandler(btnLogin_Click);
                    btnLogin.Top = top;
                    addInput(btnLogin);
                    this.AcceptButton = btnLogin;
                }
            }
        }
Beispiel #2
0
 private void setInputControlValue(MyInput input, string value)
 {
     if (input.InvokeRequired)
     {
         input.Invoke(new setInputControlValueHandler(setInputControlValue), input, value);
     }
     else
     {
         input.tagValue = value;
     }
 }