private void ChangeCheckedStateOfNodes(vbext_ComponentType type, bool state) { foreach (TreeNode nd in Nodes) { Business.Component item = (Business.Component)nd.FirstNode.Tag; if (item.Type == type) { nd.Checked = state; CheckChildren(nd, state); } } }
/// <summary> /// Sets the accessibility of given label and according to given state /// will set a font. The inversion of given state is saved to the Tag property /// to be able perform action when user click on a label again. Will work like a switcher /// </summary> /// <param name="lbl"></param> /// <param name="component"></param> /// <param name="state"></param> private void ManageState(Label lbl, Business.Component component, bool state) { lbl.Enabled = component != null; lbl.Font = state ? _fnUnderlined : _fnBold; lbl.Tag = !state; // this flag will be sent to listener and it's like switcher }