本文整理汇总了C#中System.Windows.Forms.Label.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# Label.BeginInvoke方法的具体用法?C# Label.BeginInvoke怎么用?C# Label.BeginInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.Label
的用法示例。
在下文中一共展示了Label.BeginInvoke方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetLabelText
public static void SetLabelText(Label label, string text)
{
if (label.InvokeRequired)
{
label.BeginInvoke(new Action(() =>
{
label.Text = text;
}));
}
else
{
label.Text = text;
}
}
示例2: UpdateStatus
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();
}
}
示例3: Success
private void Success(Label l)
{
l.BeginInvoke(new EventHandler(delegate
{
l.Text = "Passed";
l.ForeColor = Color.Green;
}));
}
示例4: SetLabelText
public void SetLabelText(Label anything, string text)
{
anything.BeginInvoke((MethodInvoker)delegate
{
try
{
anything.Text = text;
}
catch
{
}
});
}
示例5: SetLabelText
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;
}
}
示例6: SetLabelText
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;
}
}
示例7: CrossThreadUpdateLabel
/// <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;
}
}
示例8: SetText
public static void SetText(Label varLabel, string newText)
{
if (varLabel.InvokeRequired)
{
varLabel.BeginInvoke(new MethodInvoker(() => SetText(varLabel, newText)));
}
else
{
varLabel.Text = newText;
}
}
示例9: SetText
private static void SetText(Label box, string text)
{
if (box.InvokeRequired) //
box.BeginInvoke(new Action(() => SetText(box, text)));
else
box.Text = text;
}
示例10: lblSetText
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;
}
}