コード例 #1
0
 /// <summary>
 /// Sets the checked.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">if set to <c>true</c> [value].</param>
 public static void SetChecked(this RadioButton control, bool value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetChecked(value)));
     }
     else
     {
         control.Checked = value;
         control.Refresh();
     }
 }
コード例 #2
0
 /// <summary>
 /// Sets the text align.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetTextAlign(this RadioButton control, ContentAlignment value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetTextAlign(value)));
     }
     else
     {
         control.TextAlign = value;
         control.Refresh();
     }
 }
コード例 #3
0
 /// <summary>
 /// Sets the appearance.
 /// </summary>
 /// <param name="control">The control.</param>
 /// <param name="value">The value.</param>
 public static void SetAppearance(this RadioButton control, Appearance value)
 {
     if (control.InvokeRequired)
     {
         control.BeginInvoke(new MethodInvoker(() => control.SetAppearance(value)));
     }
     else
     {
         control.Appearance = value;
         control.Refresh();
     }
 }
コード例 #4
0
 public void SetRadioBoxChecked(RadioButton anything, bool state)
 {
     anything.BeginInvoke((MethodInvoker) delegate
     {
         try
         {
             anything.Checked = state;
         }
         catch
         {
         }
     });
 }
コード例 #5
0
        /// <summary>
        /// 状態変更時にメッセージボックスを表示する
        /// </summary>
        /// <param name="radioButton">チェックボックス</param>
        static void CheckedChangeEvent(RadioButton radioButton)
        {
            EventHandler handler = null;

            handler = delegate
            {
                MessageBox.Show("");
                radioButton.BeginInvoke((MethodInvoker) delegate
                {
                    radioButton.CheckedChanged -= handler;
                });
            };
            radioButton.CheckedChanged += handler;
        }