public void SetControlText(string controlName, string text) { if (Controls[controlName] != null) { Control control = Controls[controlName]; //進行資料委派 if (control != null) { if (control.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetControlText); this.Invoke(d, new object[] { controlName, text }); } else { RichTextBox AA = (RichTextBox)control; //text = text + "," + DateTime.Now.ToString("yyyy/MM/dd HH:mm:sssssss")+"\r\n"; text = text + "\r\n"; AA.AppendText(text); //control.Text = text; } } } }
public void SetThreadText(string str) { try { if (!object.ReferenceEquals(_richTextBox, null)) { if (_richTextBox.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetThreadText); _richTextBox.Invoke(d, new object[] { str }); } else { if (_richTextBox.Lines.Count() > 600) { _richTextBox.Text = str; } else { _richTextBox.AppendText(str); _richTextBox.ScrollToCaret(); } Application.DoEvents(); } } } catch { ; } }
private void SetLabel() { if (label1.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetLabel); this.Invoke(d, new object[] { }); } else { if ((label1.BackColor.R % 10) == 0) { label1.BackColor = Color.FromArgb(label1.BackColor.R + 40, 255, 255 - label1.BackColor.R); if (label1.BackColor.R == 240) { label1.BackColor = Color.FromArgb(255, 255, 0); } } else { label1.BackColor = Color.FromArgb(label1.BackColor.R - 40, 255, 255 - label1.BackColor.R); if (label1.BackColor.R == 15) { label1.BackColor = Color.FromArgb(0, 255, 255); } } } }
public static void SetTextInLabel(string text, Label label) { if (label.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetTextInLabel); label.Invoke(d, new object[] { text, label }); } else { label.Text = text; } }
private void UpdateLabel(string text) { if (this.lbAction.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(UpdateLabel); this.Invoke(d, new object[] { text }); } else { this.lbAction.Text = text; } }
private void SetLabel(string text) { if (InvokeRequired) { SetLabelCallback callback = new SetLabelCallback(SetLabel); this.Invoke(callback, new object[] { text }); } else { lblMsg.Text = text; } }
public void SetLabel(Label label, string text) { if (label.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetLabel); label.Parent.Invoke(d, new object[] { label, text }); } else { label.Text = text; } }
private void SetStatusText(string text) { if (InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetStatusText); this.Invoke(d, new object[] { text }); } else { statusText.Text = text; } }
public void set_label_delegate(Label target, string value) { if (target.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(set_label_delegate); form.Invoke(d, new object[] { target, value }); } else { target.Text = value; target.Visible = true; } }
public void SetLabel(Label label, string text) { if (label.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetLabel); label.Invoke(d, new object[] { label, text }); } else { label.Text = text; label.Refresh(); Invalidate(); } }
private void UpdateLabel(Label label, string text) { if (label.InvokeRequired) { SetLabelCallback d = UpdateLabel; label.Invoke(d, new object[] { label, text }); } else { label.Text = text; label.Refresh(); Invalidate(); } }
protected void SetValueLabel(string text, Label lblValue) { // 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 (lblValue.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetValueLabel); this.Invoke(d, new object[] { text, lblValue }); } else { lblValue.Text = text; } }
private void SetLabel(string text, Label label) { try { if (!string.IsNullOrEmpty(text)) { if (label.InvokeRequired) { var delgt = new SetLabelCallback(SetLabel); Invoke(delgt, new object[] { text, label }); } else { label.Text = text; } } } catch (Exception ex) { Utils.Instance.MessageBoxDebug("SetLabel: " + ex.ToString()); } }
public void SetControlText2(string controlName, string text) { if (Controls[controlName] != null) { Control control = Controls[controlName]; //進行資料委派 if (control != null) { if (control.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetControlText2); this.Invoke(d, new object[] { controlName, text }); } else { control.Text = text; } } } }
private void DataReceived(int id, string data) { // 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 (id > 0) { if (this.panel1.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(UpdateLabel); this.Invoke(d, new object[] { id, data }); } else UpdateLabel(id, data); } else { if (this.receivedDataTextBox.InvokeRequired) { SetTextCallback d = new SetTextCallback(SetReceivedText); this.Invoke(d, new object[] { data }); } else this.SetReceivedText(data); } }
public void SetLabel(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 (this.InvokeRequired) { SetLabelCallback d = new SetLabelCallback(SetLabel); try { this.Invoke(d, new object[] { text }); } catch { } } else { this.lblAction.Text = text; } }