private void InitializeForm(MainForm main) { var SelectFontStyle = new Font("Arial", 8.0f, FontStyle.Bold); ItemChangerPanel = new Panel(); ItemChangerPanel.Location = new Point(10, 100); ItemChangerPanel.Size = new Size(180, 700); //item set selector var setSelector = new ComboBox(); setSelector.Location = new Point(0,0); setSelector.Size = new Size(180, 20); setSelector.Font = SelectFontStyle; setSelector.DataSource = ItemSets; //setSelector.HandleCreated += (sender, args) => setSelector.DataSource = ItemSets; setSelector.DisplayMember = "Name"; setSelector.ValueMember = "Name"; setSelector.SelectedValueChanged += (sender, args) => LoadItemSet((sender as ComboBox).SelectedValue as string); ItemChangerPanel.Controls.Add(setSelector); var loadButton = new Button(); loadButton.Location = new Point(0, 25); loadButton.Size = new Size(55, 20); loadButton.Font = SelectFontStyle; loadButton.Click += (sender, args) => { }; loadButton.Text = "New"; ItemChangerPanel.Controls.Add(loadButton); var saveButton = new Button(); saveButton.Location = new Point(60, 25); saveButton.Size = new Size(55, 20); saveButton.Font = SelectFontStyle; saveButton.Click += (sender, args) => CreateItemFiles(setSelector.SelectedValue as string); saveButton.Text = "Save"; ItemChangerPanel.Controls.Add(saveButton); var deleteButton = new Button(); deleteButton.Location = new Point(130, 25); deleteButton.Size = new Size(50, 20); deleteButton.Font = SelectFontStyle; deleteButton.Click += (sender, args) => { }; deleteButton.Text = "Delete"; ItemChangerPanel.Controls.Add(deleteButton); //item selectors const int yOffset = 100; const int blockHeight = 100; ItemIcons = new PictureBox[n]; ItemSelectors = new ComboBox[n]; ItemDescriptions = new Label[n]; for (int i = 0; i < n; i++) { var itemSelector = new ComboBox(); itemSelector.DropDownStyle = ComboBoxStyle.DropDownList; itemSelector.DisplayMember = "Name"; itemSelector.ValueMember = "ItemId"; itemSelector.Size = new Size(180,20); itemSelector.Location = new Point(0, yOffset + blockHeight * i); itemSelector.Tag = i; itemSelector.SelectedIndexChanged += ItemSelected; itemSelector.DataSource = GameData.Items.Values.ToList(); itemSelector.HandleCreated += (sender, args) => LoadItemSet(ItemSets[0].Name); itemSelector.Font = SelectFontStyle; var itemIcon = new PictureBox(); itemIcon.Size = new Size(64, 64); itemIcon.Location = new Point(0, 25 + yOffset + blockHeight * i); itemIcon.Tag = i; var itemDescription = new Label(); itemDescription.Size = new Size(126, 64); itemDescription.Location = new Point(64, 25 + yOffset + blockHeight * i); itemDescription.Tag = i; itemDescription.Font = new Font("Tahoma", 7.0f); itemDescription.ForeColor = Color.FromArgb(200, 200, 200); ItemSelectors[i] = itemSelector; ItemIcons[i] = itemIcon; ItemDescriptions[i] = itemDescription; ItemChangerPanel.Controls.Add(itemSelector); ItemChangerPanel.Controls.Add(itemIcon); ItemChangerPanel.Controls.Add(itemDescription); } main.AddPanel(ItemChangerPanel); }
public void Initialize(MainForm main) { LoadItemSets(); InitializeForm(main); }