public void AddTool(VMSubTool tool) { var rdo = new RadioButton { Name = tool.GetName(), Text = tool.GetName(), //Appearance = Appearance.Button, AutoSize = true, //Size = new Size(110, 17) }; rdo.Click += (sender, e) => SelectTool(tool); ButtonLayoutPanel.Controls.Add(rdo); if (!_tools.Any()) { rdo.Checked = true; SelectTool(tool); } _tools.Add(tool); }
public void SelectTool(VMSubTool tool) { ControlPanel.Text = tool.GetName(); ControlPanel.Controls.Clear(); if (tool.Control != null) { ControlPanel.Controls.Add(tool.Control); //ControlPanel.Height = tool.Control.PreferredSize.Height; tool.Control.Dock = DockStyle.Top; } OnToolSelected(tool); }
public void SetSelectedTool(VMSubTool tool) { foreach (RadioButton rb in ButtonLayoutPanel.Controls) { if (rb.Name != tool.GetName()) { rb.Checked = false; } else if (!rb.Checked) { rb.Checked = true; } } }