Exemple #1
0
        /// <summary>
        /// Set the Enabled property of check boxes
        /// </summary>
        /// <param name="form">The calling form</param>
        /// <param name="control"></param>
        /// <param name="value"></param>
        public static void SetEnabled(Form form, Control control, bool value)
        {
            if (control.InvokeRequired)
            {
                SetCheckboxEnabledCallback d = new SetCheckboxEnabledCallback(SetEnabled);
                form.Invoke(d, new object[] { form, control, value });

                return;
            }

            control.Enabled = value;
        }
Exemple #2
0
        /// <summary>
        /// Set the Checked property of check boxes
        /// </summary>
        /// <param name="form">The calling form</param>
        /// <param name="control"></param>
        /// <param name="value"></param>
        public static void SetCheckboxEnabled(Form form, CheckBox control, bool value)
        {
            // InvokeRequired required compares the thread ID of the
            // calling thread to the thread ID of the creating thread.
            // If these threads are different, it returns true.
            if (control.InvokeRequired)
            {
                SetCheckboxEnabledCallback d = new SetCheckboxEnabledCallback(SetCheckboxEnabled);
                form.Invoke(d, new object[] { form, control, value });

                return;
            }

            control.Checked = value;
        }