public FormTest5() { InitializeComponent(); // グループA controlGroupA.Add(buttonA); controlGroupA.Add(checkBoxA); controlGroupA.Add(comboBoxA); controlGroupA.Enabled = false; // グループB controlGroupB.Add(buttonB); controlGroupB.Add(checkBoxB); controlGroupB.Add(comboBoxB); controlGroupB.Enabled = false; }
private void AddToGroup(ControlGroup taskGroup, TaskView taskView) { if (taskGroup.Count == 0) { taskGroup.Add(taskView); // add if list is empty } else { for (int i = taskGroup.Count - 1; i >= 0; i--) { TaskView tv = (TaskView)taskGroup[i]; if (tv.DueDate > taskView.DueDate) { continue; } else { taskGroup.Insert(i + 1, taskView); // add in the middle or end return; } } taskGroup.Insert(0, taskView); // add at the top after all controls are moved down using loop } }
private void Form1_Load(object sender, EventArgs e) { RatCow.Controls.GDIPlusGraphicsContext.GraphicContext.Init(); var image = new Bitmap(this.Width - 20, this.Height - 20); GraphicContext.Instance.NativeTargetObject = image; pictureBox1.Image = image; var button1 = new Button() { Top = 30, Left = 30, Height = 35, Width = 50, Text = "test", Enabled = true, Visible = true, Focused = false, Name = "Button1" }; button1.Click += new ControlAction(button1_Click); var button2 = new Button() { Top = 30, Left = 30, Height = 35, Width = 50, Text = "test", Enabled = true, Visible = true, Focused = false, Name = "Button2" }; button2.Click += new ControlAction(button1_Click); var textBox1 = new TextBox() { Top = 100, Left = 100, Height = 35, Width = 100, Enabled = true, Visible = true, Focused = false, Selected = false }; var cbx1 = new CheckBox() { Top = 100, Left = 30, Height = 35, Width = 50, Text = "test", Enabled = true, Visible = true, Focused = false, Name = "Checkbox1" }; var pnl1 = new Panel() { Top = 150, Left = 100, Height = 100, Width = 150, Text = "test", Enabled = true, Visible = true }; pnl1.Controls.Add(button2); var rd1 = new RadioButton() { Top = 150, Left = 30, Height = 35, Width = 50, Text = "test 1", Enabled = true, Visible = true, Focused = false, Name = "rd1" }; var rd2 = new RadioButton() { Top = 180, Left = 30, Height = 35, Width = 50, Text = "test 2", Enabled = true, Visible = true, Focused = false, Name = "rd2" }; var rd3 = new RadioButton() { Top = 210, Left = 30, Height = 35, Width = 50, Text = "test 3", Enabled = true, Visible = true, Focused = false, Name = "rd3" }; grp.Add(rd1); grp.Add(rd2); grp.Add(rd3); GraphicContext.Instance.GraphicsObjects.Add(button1); GraphicContext.Instance.GraphicsObjects.Add(textBox1); GraphicContext.Instance.GraphicsObjects.Add(cbx1); GraphicContext.Instance.GraphicsObjects.Add(pnl1); GraphicContext.Instance.GraphicsObjects.Add(rd1); GraphicContext.Instance.GraphicsObjects.Add(rd2); GraphicContext.Instance.GraphicsObjects.Add(rd3); }