/// <summary> /// Updates the current tile based on which tileset was selected /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void UpdateCurrentTile(object sender, EventArgs e) { if (sender is ImageBox) { ImageBox temp = (ImageBox)sender; currentTile = temp.Tag.ToString(); //eventually put an indicator behind the selected tile } else if (sender is Label) { Label temp = (Label)sender; currentTile = temp.Tag.ToString(); //same here } else { throw new Exception("Updater is not of ImageBox or Label type"); } }
/// <summary> /// Sets up tablet or changes the tablet interface when a row or column count is changed /// </summary> /// <param name="row"></param> /// <param name="col"></param> /// <param name="parent"></param> private void TabletSetup(int row, int col, Panel parent) { //**************************************************** //**************** Main Tablet Setup ***************** //**************************************************** //creates a set of lists that contain each row of tablet buttons (ImageBoxes) for (int rows = 0; rows < Rows; rows++) { List <ImageBox> current = new List <ImageBox>(); for (int columns = 0; columns < Columns; columns++) { //Sets up all the initial button parameters ImageBox temp = new ImageBox(); temp.Width = parent.Width / Columns; temp.Width = (parent.Width - temp.Width) / Columns; temp.Height = temp.Width; temp.Image = ImageSelect("noTexture"); temp.Top = (rows * temp.Height) + temp.Width; temp.Left = (columns * temp.Width) + temp.Width; temp.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; temp.SizeMode = PictureBoxSizeMode.Zoom; temp.Click += TabletBtnClicked; //adds the button to the parent container's controls as well as the containing list parent.Controls.Add(temp); current.Add(temp); } //Adds the current list of tablet buttons to the list of rows RowList.Add(current); } //**************************************************** //***************** Tablet Extenders ***************** //**************************************************** int baseHeightWidth = parent.Controls[0].Height; /* * addBottomRow = new Button(); * addBottomRow.Height = baseHeightWidth / 2; //put on hold to get functionality first * addBottomRow.Width = baseHeightWidth * Columns; //will be returned to later to get working * addBottomRow.Text = "+ + + + +"; * addBottomRow.BackColor = Color.Gainsboro; * addBottomRow.Top = baseHeightWidth * (Rows + 1); * addBottomRow.Left = baseHeightWidth; * addBottomRow.Click += AddRowBottom; //set these up to connect to collections * //of lists which can do the heavy lifting * addTopRow = new Button(); //the lists will replace the 2d arrays * addTopRow.Height = baseHeightWidth / 2; * addTopRow.Width = baseHeightWidth * Columns; * addTopRow.Text = "+ + + + +"; * addTopRow.BackColor = Color.Gainsboro; * addTopRow.Top = baseHeightWidth / 2; * addTopRow.Left = baseHeightWidth; * addTopRow.Click += AddRowTop; * * addLeftColumn = new Button(); * addLeftColumn.Width = baseHeightWidth / 2; * addLeftColumn.Height = baseHeightWidth * Rows; * addLeftColumn.Text = "+\n+\n+\n+\n+"; * addLeftColumn.BackColor = Color.Gainsboro; * addLeftColumn.Top = baseHeightWidth; * addLeftColumn.Left = baseHeightWidth / 2; * addLeftColumn.Click += AddColumnLeft; * * addRightColumn = new Button(); * addRightColumn.Width = baseHeightWidth / 2; * addRightColumn.Height = baseHeightWidth * Rows; * addRightColumn.Text = "+\n+\n+\n+\n+"; * addRightColumn.BackColor = Color.Gainsboro; * addRightColumn.Top = baseHeightWidth; * addRightColumn.Left = (baseHeightWidth * Columns) + baseHeightWidth; * addRightColumn.Click += AddColumnRight; * * parent.Controls.Add(addLeftColumn); * parent.Controls.Add(addRightColumn); * parent.Controls.Add(addTopRow); * parent.Controls.Add(addBottomRow); */ }