コード例 #1
0
        public ComboBox AddComboBoxToForm(GroupBox G, int x, int y)
        {
            ComboBox C = new ComboBox();

            C.Size          = new Size(350, 20);
            C.Location      = new Point(230 + x, 20 + y);
            C.Anchor        = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right)));
            C.Name          = "cmb_" + Ncontrol.ToString();
            C.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
            Ncontrol++;
            C.Items.Add("");
            foreach (DataRow R in this.consip_category.Select(QHC.CmpEq("active", "S")))
            {
                C.Items.Add(R["description"]);
            }
            C.SelectedIndexChanged += new System.EventHandler(this.ComboBoxCategory_SelectedIndexChanged);
            G.Controls.Add(C);
            return(C);
        }
コード例 #2
0
        public TextBox AddTextBoxToForm(GroupBox G, int x, int y, string tipo)
        {
            TextBox T = new TextBox();


            T.Location = new Point(230 + x, 20 + y);
            T.Anchor   = ((AnchorStyles)((AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right)));
            T.Name     = "txt_" + Ncontrol.ToString();
            if (tipo == "c")
            {
                T.Tag       = "x.y.c";
                T.GotFocus += new System.EventHandler(HelpForm.EnterDecTextBox);
                T.Leave    += new System.EventHandler(HelpForm.LeaveDecTextBox);
                T.Multiline = false;
                T.Size      = new Size(350, 10);
                T.TextAlign = HorizontalAlignment.Right;
            }
            else
            {
                if (tipo == "n")
                {
                    T.Tag       = "x.y.n";
                    T.GotFocus += new System.EventHandler(HelpForm.EnterNumTextBox);
                    T.Leave    += new System.EventHandler(HelpForm.LeaveNumTextBox);
                    T.Multiline = false;
                    T.Size      = new Size(350, 10);
                    T.TextAlign = HorizontalAlignment.Right;
                }
                else
                {
                    T.Multiline  = true;
                    T.Size       = new Size(350, 40);
                    T.ScrollBars = ScrollBars.Vertical;
                }
            }
            Ncontrol++;
            T.Leave += new System.EventHandler(this.txt_Leave);
            G.Controls.Add(T);
            return(T);
        }