示例#1
0
        /*
         * Dynamically generates all of the menu items in a category. All category
         * items are generated at once.
         */
        private void load_items()
        {
            for (int i = 0; i < itemList.Count; i++)
            {
                Button tempButton = new Button();

                tempButton.Name = "btn_" + itemList[i];
                tempButton.Text = itemList[i];

                tempButton.BackColor = Color.White;
                tempButton.Width     = SMALL_SIZE_X;
                tempButton.Height    = SMALL_SIZE_Y;
                tempButton.Click    += new EventHandler(CustomItem_Click);
                this.Controls.Add(tempButton);
                GroupBox tempGrp = findBox(orderController.getCategoryOfMenuItem(itemList[i]));
                tempButton.Location = findPosition(tempGrp);
                tempGrp.Controls.Add(tempButton);
            }
        }
示例#2
0
        // ---------------------------------------------------------------------
        // Dynamically generates all of the menu items in a category.
        // All category items are generated at once.
        // ---------------------------------------------------------------------
        private void load_items()
        {
            int x = 0;

            for (int i = 0; i < itemList.Count; i++)
            {
                string   name    = "btn_" + itemList[i];
                GroupBox itemGrp = findBox(categoryGrpBxList, orderController.getCategoryOfMenuItem(itemList[i]));
                Button   itemBtn = (new CustomButton(name, itemList[i], findPosition(itemGrp), Color.White, smallX, smallY)).toButton();
                itemBtn.Click += new EventHandler(CustomItem_Click);

                this.Controls.Add(itemBtn);
                itemGrp.Controls.Add(itemBtn);
                if (i == 0)
                {
                    x = itemBtn.Location.X;
                }
            }
            for (int i = 0; i < categoryGrpBxList.Count; i++)
            {
                int row = (categoryGrpBxList[i].Controls.Count / PER_ROW) + 1;
                if (categoryGrpBxList[i].Controls.Count % PER_ROW == 0)
                {
                    row--;
                }
                int    y          = (row) * (spacingY + smallY);
                Point  posBack    = new Point(x, y);
                Button backButton = (new CustomButton("btn_back", "Back", posBack, Color.White, smallX, smallY)).toButton();
                backButton.Click += new EventHandler(CustomBack_Click);
                categoryGrpBxList[i].Controls.Add(backButton);
            }
        }
 /*
  * Dynamically generates all of the menu items in a category. All category
  * items are generated at once.
  */
 private void load_items()
 {
     for (int i = 0; i < itemList.Count; i++)
     {
         string   name    = "btn_" + itemList[i];
         GroupBox itemGrp = findBox(categoryGrpBxList, orderController.getCategoryOfMenuItem(itemList[i]));
         Button   itemBtn = (new CustomButton(name, itemList[i], findPosition(itemGrp), Color.White, smallX, smallY)).toButton();
         itemBtn.Click += new EventHandler(CustomItem_Click);
         this.Controls.Add(itemBtn);
         itemGrp.Controls.Add(itemBtn);
     }
 }