protected override void OnCheckedChanged(EventArgs e) { base.OnCheckedChanged(e); if (Checked && Parent != null) { // Clear the checked state for all siblings. foreach (ToolStripItem item in Parent.Items) { ToolStripRadioButtonMenuItem radioItem = item as ToolStripRadioButtonMenuItem; if (radioItem != null && radioItem != this && radioItem.Checked) { radioItem.Checked = false; // Only one item can be selected at a time, // so there is no need to continue. return; } } } }
public void AddEnumClipboardContentWithRuntimeSettings(ToolStripDropDownButton tsddb, List<ClipboardContentEnum> ClipboardContentType) { if (tsddb.DropDownItems.Count == 0) { foreach (ClipboardContentEnum t in Enum.GetValues(typeof(ClipboardContentEnum))) { ToolStripRadioButtonMenuItem tsmi = new ToolStripRadioButtonMenuItem(t.GetDescription()); tsmi.Tag = t; tsmi.Checked = ClipboardContentType.Contains(t); tsmi.Click += new EventHandler(tsmiDestClipboardContent_Click); tsddb.DropDownItems.Add(tsmi); } } UpdateToolStripClipboardContent(); ucDestOptions.EnableDisableDestControls(); }