本文整理汇总了C#中System.Windows.Forms.TextBox.BeginInvoke方法的典型用法代码示例。如果您正苦于以下问题:C# TextBox.BeginInvoke方法的具体用法?C# TextBox.BeginInvoke怎么用?C# TextBox.BeginInvoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.Forms.TextBox
的用法示例。
在下文中一共展示了TextBox.BeginInvoke方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetTextBoxText
public void SetTextBoxText(TextBox anything, string text)
{
anything.BeginInvoke((MethodInvoker)delegate
{
anything.Text = text;
});
}
示例2: UpdateTextBoxInvoke
public void UpdateTextBoxInvoke(TextBox box, string displayText, int linesToshow)
{
Object[] args = new object[3];
args[0] = box;
args[1] = displayText;
args[2] = linesToshow;
box.BeginInvoke(textBoxDelegate, args);
}
示例3: AppendToTextBox
public static void AppendToTextBox(string text, TextBox txtBox)
{
if (txtBox.InvokeRequired)
{
txtBox.BeginInvoke(
new MethodInvoker(delegate() { AppendToTextBox(text, txtBox); })
);
}
else
{
txtBox.AppendText(text);
}
}
示例4: SetTextBoxText
public static void SetTextBoxText(TextBox textBox, string text)
{
if (textBox.InvokeRequired)
{
textBox.BeginInvoke(new Action(() =>
{
textBox.Text = text;
}));
}
else
{
textBox.Text = text;
}
}
示例5: AppendTextToTxtLog
public static void AppendTextToTxtLog(string str, TextBox t)
{
if (t.InvokeRequired)
{
t.BeginInvoke(new Action<string>(s =>
{
t.Text = string.Format("{0}\r\n{1}", s, t.Text);
}), str);
}
else
{
t.Text = string.Format("{0}\r\n{1}", str, t.Text);
}
}
示例6: SetTextboxMsg
/// <summary>
/// Method to update text on a textbox.
/// </summary>
/// <param name="msg">String type message</param>
/// <param name="box">Textbox to set text</param>
private void SetTextboxMsg(string msg, TextBox box)
{
if (box.InvokeRequired)
{
object[] pList = { msg, box };
box.BeginInvoke(new SetTextboxMsgCallBack(SetTextboxMsg), pList);
}
else
{
box.Text = msg;
}
}
示例7: UpdateStatus
private void UpdateStatus(TextBox lbl, string status)
{
if (lbl.InvokeRequired)
{
lbl.BeginInvoke(new Action<TextBox, string>(UpdateStatus), lbl, status);
}
else
{
lbl.Text = status;
lbl.Update();
lbl.Parent.Update();
}
}
示例8: SetTextBoxState
public void SetTextBoxState(TextBox anything, bool state)
{
anything.BeginInvoke((MethodInvoker)delegate
{
try
{
anything.Enabled = state;
}
catch
{
}
});
}
示例9: SetTextSafe
private void SetTextSafe(TextBox txtBox, string newText)
{
if (txtBox.InvokeRequired)
{
txtBox.BeginInvoke(_delegateSetTextSafe, txtBox, newText);
}
else
{
var sb = new StringBuilder(newText);
sb.Append(txtBox.Text);
txtBox.Text = sb.ToString();
}
}
示例10: ShowMsgInTextBox
public static void ShowMsgInTextBox(TextBox box, string msg, bool logInConsole = true)
{
if (box == null)
{
return; // TextBox对象不存在
}
else
{
MethodInvoker action = () => box.AppendText(msg + "\r\n");
try
{
box.BeginInvoke(action);
}
catch (InvalidOperationException ex)
{
BstLogger.Instance.Log(ex.ToString()); // 有的时候在显示的时候TextBox已经被销毁,忽略错误
}
}
if (logInConsole)
{
BstLogger.Instance.Log(msg);
}
}
示例11: SetText
// disposer chaque text recue a sa position finale
private static void SetText(TextBox box, string text)
{
if (box.InvokeRequired) //
box.BeginInvoke(new Action(() => SetText(box, text)));
else
box.Text = text;
}
示例12: SetText
void SetText(TextBox eb, string s)
{
if (eb.InvokeRequired)
eb.BeginInvoke(new SetTextDel(DoSetText), new object[] {eb, s});
else
DoSetText(eb, s);
}