/// <summary> /// Create product tab page buttons. /// </summary> private List <OrderProductTabPageButton> CreateProductTabPageButtons() { var productTabPageButtons = new List <OrderProductTabPageButton>(); for (int i = 0; i < AppDefinition.TAB_PAGE_MAX_PRODUCTS_COUNT; i++) { OrderProductTabPageButton button = new OrderProductTabPageButton(); button.Click += (sender, eventArguments) => SelectProduct(button.Product); productTabPageButtons.Add(button); } return(productTabPageButtons); }
/// <summary> /// Populate product tab page buttons onto the product tab page whose index is tabPageIndex. /// </summary> private void PopulateProductTabPageButtons(TableLayoutPanel tabPageLayout, int tabPageIndex) { int productTabPageButtonsCount = 0; for (int row = 0; row < AppDefinition.TAB_PAGE_LAYOUT_ROW_COUNT; row++) { for (int column = 0; column < AppDefinition.TAB_PAGE_LAYOUT_COLUMN_COUNT; column++) { OrderProductTabPageButton button = _productTabPageButtonsContainers[tabPageIndex][productTabPageButtonsCount]; tabPageLayout.Controls.Add(button, column, row); button.Dock = DockStyle.Fill; // Make button fill in table cell productTabPageButtonsCount++; } } }