当前位置: 首页>>代码示例>>C#>>正文


C# TextBoxBase.Invoke方法代码示例

本文整理汇总了C#中System.Windows.Forms.TextBoxBase.Invoke方法的典型用法代码示例。如果您正苦于以下问题:C# TextBoxBase.Invoke方法的具体用法?C# TextBoxBase.Invoke怎么用?C# TextBoxBase.Invoke使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.TextBoxBase的用法示例。


在下文中一共展示了TextBoxBase.Invoke方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AppendText

 public static void AppendText(TextBoxBase control, string text)
 {
     if (control.InvokeRequired)
         control.Invoke(new AppendTextDelegate(AppendText), control, text);
     else
         control.AppendText(text);
 }
开发者ID:greeduomacro,项目名称:phoenix,代码行数:7,代码来源:Safe.cs

示例2: TextBoxTracer

 public TextBoxTracer(TextBoxBase t, StringCollection data)
 {
     this.txtLog = t;
     this.logData = data;
     writeAction = s => t.Invoke(new Action(() =>
     {
         t.Text += s;
     }));
 }
开发者ID:HungryBear,项目名称:rayden,代码行数:9,代码来源:LogController.cs

示例3: AppendText

 public static void AppendText(TextBoxBase tb, string text)
 {
     if (tb == null) return;
     tb.SuspendLayout();
     if (tb.InvokeRequired)
     {
         tb.Invoke(new AppendTextDelegate(AppendText), new object[] { tb, text });
     }
     else
     {
         tb.SelectionStart = tb.TextLength;
         tb.SelectedText = text;
     }
     tb.ResumeLayout();
 }
开发者ID:adisik,项目名称:simple-assembly-explorer,代码行数:15,代码来源:SimpleTextbox.cs

示例4: SetCaretPosition

 /// <summary>
 /// Sets the caret position in a text box.
 /// This is just a helper function that takes care of
 /// cross-thread invokations that would result in .NET
 /// exceptions.
 /// </summary>
 public static void SetCaretPosition(TextBoxBase textBox, int position)
 {
     if (textBox.InvokeRequired)
     {
         textBox.Invoke(new setCaretPosition(SetCaretPosition), textBox, position);
     }
     else
     {
         textBox.SelectionStart = position;
     }
 }
开发者ID:rolandKulcsar,项目名称:acat,代码行数:17,代码来源:Windows.cs

示例5: GetSelectedText

        /// <summary>
        /// Returns selected text in the text box
        /// </summary>
        /// <param name="control">text box</param>
        /// <returns>selected text</returns>
        public static String GetSelectedText(TextBoxBase control)
        {
            if (control.InvokeRequired)
            {
                return (String)control.Invoke(new getSelectedText(GetSelectedText), control);
            }

            return control.SelectedText;
        }
开发者ID:rolandKulcsar,项目名称:acat,代码行数:14,代码来源:Windows.cs

示例6: GetCaretPosition

 /// <summary>
 /// Returns the caret position in a text box.
 /// This is just a helper function that takes care of
 /// cross-thread invokations that would result in .NET
 /// exceptions.
 /// </summary>
 public static int GetCaretPosition(TextBoxBase textBox)
 {
     if (textBox.InvokeRequired)
     {
         return (int)textBox.Invoke(new getCaretPosition(GetCaretPosition), textBox);
     }
     else
     {
         return textBox.SelectionStart;
     }
 }
开发者ID:rolandKulcsar,项目名称:acat,代码行数:17,代码来源:Windows.cs

示例7: UnselectText

 /// <summary>
 /// Unselect text in textbox
 /// </summary>
 /// <param name="control">the text box control</param>
 public static void UnselectText(TextBoxBase control)
 {
     if (control.InvokeRequired)
     {
         control.Invoke(new unselectText(UnselectText), control);
     }
     else
     {
         control.SelectionLength = 0;
         if (!String.IsNullOrEmpty(control.Text))
         {
             control.Select(control.Text.Length, 0);
         }
     }
 }
开发者ID:rolandKulcsar,项目名称:acat,代码行数:19,代码来源:Windows.cs

示例8: RecuperarTexto

 /// <summary>
 /// Recupera de forma segura o conteúdo do TextBox.
 /// </summary>
 /// <returns>Conteúdo do TextBox.</returns>
 private string RecuperarTexto(TextBoxBase txt)
 {
     if (txt.InvokeRequired)
     {
         RecuperarTextoCallback método = new RecuperarTextoCallback(RecuperarTexto);
         try
         {
             return (string)txt.Invoke(método, txt);
         }
         catch (Exception)
         {
             return "";
         }
     }
     else
         return txt.Text;
 }
开发者ID:andrepontesmelo,项目名称:imjoias,代码行数:21,代码来源:FormatadorNome.cs


注:本文中的System.Windows.Forms.TextBoxBase.Invoke方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。