コード例 #1
0
 private void SetCheckBox(System.Windows.Forms.CheckBox cb, bool status)
 {
     cb.BeginInvoke(new Action(() =>
     {
         cb.Checked = status;
     }));
 }
コード例 #2
0
        private void PerformToggle(SWF.CheckBox checkbox, SWF.CheckState state)
        {
            if (checkbox.InvokeRequired == true)
            {
                checkbox.BeginInvoke(new PerformToggleDelegate(PerformToggle),
                                     new object [] { checkbox, state });
                return;
            }

            // NOTE: We can count on presence of InvokeOnClick;
            //       it is a protected member of CheckBox.
            //
            //       This basically simulates a click, which always
            //       raises the Click event, but strangely does not
            //       raise CheckChanged when transitioning to
            //       Indeterminate state. This matches MS behavior.
            MethodInfo invokeOnClick =
                typeof(SWF.CheckBox).GetMethod("InvokeOnClick",
                                               BindingFlags.NonPublic |
                                               BindingFlags.Instance);

            invokeOnClick.Invoke(checkbox,
                                 new object [] { checkbox, EventArgs.Empty });
        }
コード例 #3
0
ファイル: ObjectInterface.cs プロジェクト: facchinm/SiRFLive
 public void SetCheckBoxState(CheckBox anything, bool state)
 {
     anything.BeginInvoke((MethodInvoker)delegate
     {
         try
         {
             anything.Enabled = state;
         }
         catch
         {
         }
     });
 }