Exemple #1
0
        public Form1()
        {
            InitializeComponent();


            //delegateの初期化
            setTextBoxID = new setLabelDelegate(TextBox1SetText);
        }
 private void SetLabel(Button control)
 {
     if (control.InvokeRequired)
     {
         setLabelDelegate del = new setLabelDelegate(SetLabel);
         control.Invoke(del, control);
     }
     else
     {
         SetLabel lbl = new SetLabel(control.Text);
         lbl.ShowDialog();
         if (lbl.DialogResult == DialogResult.OK)
         {
             control.Text = lbl.Label;
         }
         //control.Text =
     }
 }
 private void SetLabel(Button control)
 {
     if (control.InvokeRequired)
     {
         setLabelDelegate del = new setLabelDelegate(SetLabel);
         control.Invoke(del, control);
     }
     else
     {
         SetLabel lbl = new SetLabel(control.Text);
         lbl.ShowDialog();
         if (lbl.DialogResult == DialogResult.OK)
         {
             control.Text = lbl.Label;
         }
         //control.Text =
     }
 }