private void CheckBoxAll_CheckedChanged(object sender, EventArgs e) { var isChecked = CheckBoxAll.Checked; int c = ClbVariants.Items.Count; for (int i = 0; i < c; i++) { ClbVariants.SetItemChecked(i, isChecked); } }
/// <summary> /// Call this method before the form is shown to set the checkboxes to their correct state and the location to the cursor. /// </summary> internal void InitializeCheckStates() { var checkAll = DisabledVariants == null || !DisabledVariants.Any(); int c = ClbVariants.Items.Count; for (int i = 0; i < c; i++) { ClbVariants.SetItemChecked(i, checkAll || !DisabledVariants.Contains(ClbVariants.Items[i].ToString())); } SetDesktopLocation(Cursor.Position.X, Cursor.Position.Y); }