示例#1
0
        void moveDown(TableLayoutPanel tlp, List <TGIBlockCombo> ltbc, Label lb, TLPRenumber renumber, ref int entry)
        {
            TGIBlockCombo c1 = tlp.GetControlFromPosition(2, entry + 1) as TGIBlockCombo; //this control
            TGIBlockCombo c2 = tlp.GetControlFromPosition(2, entry + 2) as TGIBlockCombo; //the one below to swap with

            tlp.Controls.Remove(c1);                                                      //leaves entry + 1 free
            tlp.Controls.Add(c2, 2, entry + 1);                                           //leaves entry + 2 free
            tlp.Controls.Add(c1, 2, entry + 2);
            c2.TabIndex--;
            c1.TabIndex++;

            int i = ltbc.IndexOf(c1);

            ltbc.RemoveAt(i);
            ltbc.Insert(i + 1, c1);

            entry++;
            tlp.Controls.Add(lb, 1, entry + 1);
            renumber();
            c1.Focus();
        }
示例#2
0
        void AddTableRowTBC(TableLayoutPanel tlp, int entry, int index, ref int tabindex)
        {
            tlp.RowCount++;
            tlp.RowStyles.Insert(tlp.RowCount - 2, new RowStyle(SizeType.AutoSize));

            Label         lb  = new Label();
            TGIBlockCombo tbc = new TGIBlockCombo(vpxy.TGIBlocks, index, false);

            lb.AutoSize    = true;
            lb.BorderStyle = BorderStyle.Fixed3D;
            lb.Dock        = DockStyle.Fill;
            lb.FlatStyle   = FlatStyle.Standard;
            lb.Margin      = new Padding(0);
            lb.Name        = "lbEntry" + tabindex;
            lb.TabIndex++;
            lb.Text      = entry.ToString("X");
            lb.TextAlign = ContentAlignment.MiddleRight;
            lb.Tag       = tbc;
            lb.Click    += new EventHandler(lb_Click);
            tlp.Controls.Add(lb, 0, tlp.RowCount - 2);

            tbc.Anchor                = AnchorStyles.Left | AnchorStyles.Right;
            tbc.Name                  = "tbc" + tabindex;
            tbc.TabIndex              = tabindex++;
            tbc.Enter                += new EventHandler(tbc_Enter);
            tbc.SelectedIndexChanged += new EventHandler(tbc_SelectedIndexChanged);
            tlp.Controls.Add(tbc, 2, tlp.RowCount - 2);

            if (tlp == tlpParts)
            {
                ltbc.Add(tbc);
            }
            else
            {
                lLPtbc.Add(tbc);
            }
            tbc.Focus();

            tbc.TGIBlockListChanged += new EventHandler(tbg_TGIBlockListChanged);
        }