public static void SetLabelText(Label label, string text) { if (label.InvokeRequired) { label.BeginInvoke(new Action(() => { label.Text = text; })); } else { label.Text = text; } }
private void ModifyText(string text) { if (TextLabel.InvokeRequired) { TextLabel.BeginInvoke((MethodInvoker) delegate() { TextLabel.Text = text; }); } else { TextLabel.Text = text; } }
private void updateLbl(System.Windows.Forms.Label lbl, string s) { if (lbl.InvokeRequired) { lbl.BeginInvoke((MethodInvoker) delegate() { lbl.Text = s; }); } else { lbl.Text = s; } }
private void UpdateStatus(Label lbl, string status) { if (lbl.InvokeRequired) { lbl.BeginInvoke(new Action<Label, string>(UpdateStatus), lbl, status); } else { lbl.Text = status; lbl.Update(); lbl.Parent.Update(); } }
/// ///////////////////////////////////////////////////////////////// public void SetInfo(string strInfo) { m_labelInfo.BeginInvoke((MethodInvoker) delegate { StringBuilder builder = new StringBuilder(); foreach (string strLibelle in m_listeLibelles) { builder.Append(strLibelle); builder.Append("/"); } builder.Append(strInfo); m_labelInfo.Text = builder.ToString(); m_labelInfo.Refresh(); }); }
private void Ch_ConnectionStatus(enStatus bolStatus) { if (lblStatus.InvokeRequired) { lblStatus.BeginInvoke(new delCh_ConnectionStatus(Ch_ConnectionStatus), new object[] { bolStatus }); return; } if (bolStatus == enStatus.OK) { lblStatus.Text = "Open"; lblStatus.BackColor = Color.Green; } else { lblStatus.Text = "Close"; lblStatus.BackColor = Color.Red; } }
private void UpdateLabel() { // BeginInvoke may not be called on a window that doesn't // yet have a handle while (!label.IsHandleCreated) { Thread.Sleep(250); } while (true) { #if NET_2_0 Console.WriteLine("Handle:{0:X}", this.Handle.ToInt23()); #endif lock (this) { label.BeginInvoke(new updater(DateUpdater)); } Thread.Sleep(500); } }
private void Success(Label l) { l.BeginInvoke(new EventHandler(delegate { l.Text = "Passed"; l.ForeColor = Color.Green; })); }
public void SetLabelText(Label anything, string text) { anything.BeginInvoke((MethodInvoker)delegate { try { anything.Text = text; } catch { } }); }
private void SetLabelText(Label label, string text) { // 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 (label.InvokeRequired) { SetLabelTextCallback d = new SetLabelTextCallback(SetLabelText); label.BeginInvoke(d, new object[] { label, text }); } else { label.Text = text; } }
protected void SetLabelText(Label b, string value) { if (b.InvokeRequired) { SetLabelTextCallback d = new SetLabelTextCallback(SetLabelText); b.BeginInvoke(d, new object[] { b, value }); } else { b.Text = value; } }
/// <summary> /// 实现了跨线程对Label文字进行更新 /// </summary> /// <param name="lb">需要更新的Label</param> /// <param name="strMsg">需要更新的文字</param> public void CrossThreadUpdateLabel(Label lb, string strMsg) { if (lb.InvokeRequired) { DelegateforUpdateLabel del = new DelegateforUpdateLabel(CrossThreadUpdateLabel); lb.BeginInvoke(del, new Object[] { lb, strMsg }); } else { lb.Text = strMsg; } }
public static void SetText(Label varLabel, string newText) { if (varLabel.InvokeRequired) { varLabel.BeginInvoke(new MethodInvoker(() => SetText(varLabel, newText))); } else { varLabel.Text = newText; } }
private static void SetText(Label box, string text) { if (box.InvokeRequired) // box.BeginInvoke(new Action(() => SetText(box, text))); else box.Text = text; }
private void lblSetText(Label lbl, string text) { if (lbl.InvokeRequired) { lblSetTextCallback d = new lblSetTextCallback(lblSetText); lbl.BeginInvoke(d, new object[] { lbl, text }); } else { lbl.Text = text; } }