private void CheckedChangedAll(object sender, EventArgs e) { ToolStripCheckboxItem tsi = sender as ToolStripCheckboxItem; if (tsi == null) { return; } if (!tsi.Checked) { return; } if (checkboxNone != null) { checkboxNone.SetChecked(false); } foreach (ToolStripCheckboxItem item in GetToolStripCheckboxItems()) { if (item.Checked) { continue; } item.SetChecked(true); } UpdateText(); }
protected ToolStripCheckboxItem Add(CheckBoxItem item) { ToolStripCheckboxItem tsi = new ToolStripCheckboxItem(item); tsi.BackColor = this.BackColor; tsi.CheckedChanged += CheckedChanged; popup.Items.Add(tsi); ItemsAltered(); return(tsi); }
private void CheckedChanged(object sender, EventArgs e) { ToolStripCheckboxItem tsi = sender as ToolStripCheckboxItem; if (tsi == null) { return; } UpdateText(); ItemsAltered(); CheckedChanged(tsi.Item); }
private IEnumerable <ToolStripCheckboxItem> GetToolStripCheckboxItems() { foreach (ToolStripItem temp in popup.Items) { ToolStripCheckboxItem tsi = temp as ToolStripCheckboxItem; if (tsi == null) { continue; } if (tsi.Value == 0 || tsi.Value == Int64.MaxValue) { continue; } yield return(tsi); } }
protected ToolStripCheckboxItem Add(CheckBoxItem item) { ToolStripCheckboxItem tsi = new ToolStripCheckboxItem(item); tsi.BackColor = this.BackColor; tsi.Width = this.Width - 35; tsi.CheckedChanged += CheckedChanged; popup.Items.Add(tsi); ItemsAltered(); return tsi; }