protected void OnAddPage(object sender, EventArgs e) { Control controlToAdd = null; switch (_count) { case 0: case 2: case 4: case 6: controlToAdd = new DummyForm(); controlToAdd.BackColor = Color.White; break; case 1: case 5: RichTextBox rtb = new RichTextBox(); rtb.Text = "The quick brown fox jumped over the lazy dog."; controlToAdd = rtb; break; case 3: controlToAdd = new DummyPanel(); controlToAdd.BackColor = Color.DarkSlateBlue; break; } // Define color that match the tabControl controlToAdd.ForeColor = tabControl.ForeColor; controlToAdd.BackColor = tabControl.BackColor; Crownwood.Magic.Controls.TabPage page; // Create a new page with the appropriate control for display, title text and image page = new Crownwood.Magic.Controls.TabPage(_strings[_count], controlToAdd, null, _count); // Make this page become selected when added page.Selected = true; tabControl.TabPages.Add(page); // Update the count for creating new pages _count++; if (_count > 6) { _count = 0; } }
private void FillPanels(JoystickConfig joystickInfo) { foreach (var control in joystickInfo.Controls) { BaseControlPanel panel; if (control is JoystickAxle) { panel = new AxlePanel(); panel.FillFromJoyInfo(control); } else if (control is ButtonsCollection) { panel = new ButtonsPanel(); panel.FillFromJoyInfo(control); } else if (control is HatSwitch) { panel = new HatPanel(); panel.FillFromJoyInfo(control); } else if (control is LevelingBits) { panel = new DummyPanel(); panel.FillFromJoyInfo(control); } else { continue; } AddPanel(panel); } tbName.Text = joystickInfo.Name; tbCName.Text = joystickInfo.Code; }
private void FillPanels(JoystickConfig joystickInfo) { foreach (var control in joystickInfo.Controls) { BaseControlPanel panel; if (control is JoystickAxle) { panel = new AxlePanel(); panel.FillFromJoyInfo(control); } else if (control is ButtonsCollection) { panel = new ButtonsPanel(); panel.FillFromJoyInfo(control); } else if (control is HatSwitch) { panel = new HatPanel(); panel.FillFromJoyInfo(control); } else if (control is LevelingBits) { panel = new DummyPanel(); panel.FillFromJoyInfo(control); } else { continue; } AddPanel(panel); } tbName.Text = joystickInfo.Name; tbVendorProduct.Text = string.Format("{0:X4}:{1:X4}", joystickInfo.VendorID, joystickInfo.ProductID); }