예제 #1
0
        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);
        }
예제 #2
0
 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);
 }
예제 #3
0
 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;
         }
     }
 }