private void preparePanel() { //GUI mapObjects.Controls.Clear(); mapObjects.SuspendLayout(); int endIndex = Math.Min(BlocksPerPage, ConfigScript.getBlocksCount(curActiveBigBlock)); var objectTypes = ConfigScript.getBlockTypeNames(); for (int i = 0; i < endIndex; i++) { var obj = objects[i]; int curPanelX = 0; Panel fp = new Panel(); fp.Size = new Size(mapObjects.Width - 25, TileSize * obj.h); // Label lb = new Label(); lb.Location = new Point(curPanelX, 0); lb.Size = new Size(32, 32); lb.Tag = i; lb.Text = String.Format("{0:X}", i); fp.Controls.Add(lb); curPanelX += lb.Size.Width; // PictureBox pb = new PictureBox(); pb.Location = new Point(curPanelX, 0); pb.Size = new Size(TileSize * obj.w, TileSize * obj.h); pb.Tag = i; pb.MouseClick += pb_MouseClick; fp.Controls.Add(pb); curPanelX += pb.Size.Width + 6; // ComboBox cbColor = new ComboBox(); cbColor.Size = cbSubpalette.Size; cbColor.Location = new Point(curPanelX, 0); cbColor.Tag = pb; cbColor.DrawMode = DrawMode.OwnerDrawVariable; cbColor.DrawItem += cbSubpalette_DrawItemEvent; cbColor.Items.AddRange(subPalItems); cbColor.DropDownStyle = ComboBoxStyle.DropDownList; cbColor.SelectedIndexChanged += cbColor_SelectedIndexChanged; fp.Controls.Add(cbColor); curPanelX += cbColor.Size.Width; // NumericUpDown nudType = new NumericUpDown(); nudType.Size = cbSubpalette.Size; nudType.Location = new Point(curPanelX, 0); nudType.Tag = i; nudType.Minimum = 0; nudType.Maximum = objectTypes.Length - 1; nudType.Hexadecimal = true; nudType.ValueChanged += nudType_ValueChanged; fp.Controls.Add(nudType); mapObjects.Controls.Add(fp); } mapObjects.ResumeLayout(); refillPanel(); }
private void preparePanel() { //GUI mapObjects.Controls.Clear(); mapObjects.SuspendLayout(); int endIndex = Math.Min(BLOCKS_PER_PAGE, ConfigScript.getBlocksCount()); for (int i = 0; i < endIndex; i++) { var obj = objects[i]; int curPanelX = 0; Panel fp = new Panel(); fp.Size = new Size(mapObjects.Width - 25, TILE_SIZE * obj.h); // Label lb = new Label(); lb.Location = new Point(curPanelX, 0); lb.Size = new Size(32, 32); lb.Tag = i; lb.Text = String.Format("{0:X}", i); fp.Controls.Add(lb); curPanelX += lb.Size.Width; // PictureBox pb = new PictureBox(); pb.Location = new Point(curPanelX, 0); pb.Size = new Size(TILE_SIZE * obj.w, TILE_SIZE * obj.h); pb.Tag = i; pb.MouseClick += new MouseEventHandler(pb_MouseClick); fp.Controls.Add(pb); curPanelX += pb.Size.Width + 6; // ComboBox cbColor = new ComboBox(); cbColor.Size = cbSubpalette.Size; cbColor.Location = new Point(curPanelX, 0); cbColor.Tag = pb; cbColor.DrawMode = DrawMode.OwnerDrawVariable; cbColor.DrawItem += new DrawItemEventHandler(cbSubpalette_DrawItemEvent); cbColor.Items.AddRange(subPalItems); cbColor.DropDownStyle = ComboBoxStyle.DropDownList; cbColor.SelectedIndexChanged += cbColor_SelectedIndexChanged; fp.Controls.Add(cbColor); curPanelX += cbColor.Size.Width; // ComboBox cbType = new ComboBox(); var objectTypes = ConfigScript.getBlockTypeNames(); cbType.Items.AddRange(objectTypes); cbType.Location = new Point(curPanelX, 0); cbType.Size = new Size(120, 21); cbType.Tag = i; cbType.DropDownStyle = ComboBoxStyle.DropDownList; cbType.SelectedIndexChanged += cbType_SelectedIndexChanged; fp.Controls.Add(cbType); mapObjects.Controls.Add(fp); } mapObjects.ResumeLayout(); refillPanel(); }