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


C# this.AppendText方法代码示例

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


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

示例1: SetLinkedText

    public static void SetLinkedText(this BetterRichTextbox richTextBox, string htmlFragment)
    {
        var regEx = new Regex(
            @"\<a\s(href\=""|[^\>]+?\shref\="")(?<link>[^""]+)"".*?\>(?<text>.*?)(\<\/a\>|$)",
            RegexOptions.IgnoreCase | RegexOptions.Multiline);

        richTextBox.Blocks.Clear();

        int nextOffset = 0;

        foreach (Match match in regEx.Matches(htmlFragment))
        {
            if (match.Index > nextOffset)
            {
                string url = match.Groups["link"].Value.TrimStart('/');
                if (!url.Contains("http://"))
                {
                    url = "http://" + url;
                }
                richTextBox.AppendText(htmlFragment.Substring(nextOffset, match.Index - nextOffset));
                nextOffset = match.Index + match.Length;
                richTextBox.AppendLink(match.Groups["text"].Value, new Uri(url));
            }

            Debug.WriteLine(match.Groups["text"] + ":" + match.Groups["link"]);
        }

        if (nextOffset < htmlFragment.Length)
        {
            richTextBox.AppendText(htmlFragment.Substring(nextOffset));
        }
    }
开发者ID:wuchangqi,项目名称:ifixit-microsoft,代码行数:32,代码来源:RichTextBlockExtentions.cs

示例2: WriteLine

        public static void WriteLine(this TextBox tb, string s, params object [] args)
        {
            if (args.Length == 0)
            tb.AppendText (s);
              else
            tb.AppendText (string.Format (s, args));

              tb.AppendText (CRLF);
        }
开发者ID:Thermophyl,项目名称:Wissensverarbeitung,代码行数:9,代码来源:MainForm.cs

示例3: AppendTextLine

 public static void AppendTextLine(this TextBox textBox, string message)
 {
     if (!String.IsNullOrEmpty(message))
     {
         textBox.InvokeIfNeeded(delegate
         {
             textBox.AppendText(message);
             textBox.AppendText("\r\n");
         }, InvocationMethod.Asynchronous);
     }
 }
开发者ID:karlnet,项目名称:mpb,代码行数:11,代码来源:TextBoxExtensions.cs

示例4: AppendLine

        public static void AppendLine(this RichTextBox box, int space, string text, Color color)
        {
            box.AppendText("\n");
            box.SelectionStart = box.TextLength;
            box.SelectionLength = 0;

            box.SelectionColor = color;

            box.AppendText(text.PadLeft(space + text.Length, ' '));
            box.SelectionColor = box.ForeColor;
        }
开发者ID:abhishek-t,项目名称:SpecRunner,代码行数:11,代码来源:Extentions.cs

示例5: AppendLine

        public static void AppendLine(this RichTextBox ed, string s)
        {
            int ss = ed.SelectionStart;
            ed.AppendText(s);
            int sl = ed.SelectionStart - ss + 1;

            Font bold = new Font(ed.Font, FontStyle.Regular);
            ed.Select(ss, sl);
            ed.SelectionFont = bold;
            ed.AppendText(NewLine);
        }
开发者ID:tsunamisukoto,项目名称:Book-A-Majig2,代码行数:11,代码来源:UIExtensionMethods.cs

示例6: AppendTextSafe

 /// <summary>
 /// Thread-safe wrapper for <see cref="System.Windows.Forms.TextBoxBase.AppendText(string)"/>.
 /// </summary>
 /// <param name="control">The <see cref="System.Windows.Forms.TextBoxBase"/>.</param>
 /// <param name="value">The <see cref="string"/> to set.</param>
 public static void AppendTextSafe(this TextBoxBase control, string value)
 {
     if (control.InvokeRequired)
     {
         control.Invoke((Action<string>)((string var) => control.AppendText(var)), value);
     }
     else
     {
         control.AppendText(value);
     }
 }
开发者ID:jakepetroules,项目名称:jakes-3d-mmo,代码行数:16,代码来源:LambdaHelper.TextBoxBase.cs

示例7: AppendBoldColoredLine

        public static void AppendBoldColoredLine(this RichTextBox ed, string s,Color passedInColor)
        {
            int ss = ed.SelectionStart;
            ed.AppendText(s);
            int sl = ed.SelectionStart - ss + 1;

            Font bold = new Font(ed.Font, FontStyle.Bold);

            ed.Select(ss, sl);
            ed.SelectionFont = bold;
            ed.SelectionColor = passedInColor;
            ed.AppendText(NewLine);
        }
开发者ID:tsunamisukoto,项目名称:Book-A-Majig2,代码行数:13,代码来源:UIExtensionMethods.cs

示例8: AppendFormatLine

        public static void AppendFormatLine(this TextBoxBase textbox, string format, params object[] args)
        {
            Contract.Requires(format != null);
            Contract.Requires(args != null);

            textbox.AppendText(String.Format(format, args) + Environment.NewLine);
        }
开发者ID:azuritus,项目名称:spellwork,代码行数:7,代码来源:RichTextBoxExtensions.cs

示例9: AppendLine

 public static void AppendLine(this TextBox source, string value)
 {
     if (source.Text.Length == 0)
         source.Text = value;
     else
         source.AppendText(Environment.NewLine + value);
 }
开发者ID:roxocode,项目名称:wether_diary,代码行数:7,代码来源:ExtentionMethods.cs

示例10: AppendFormatLine

 public static void AppendFormatLine(this RichTextBox textbox, string format, params object[] arg0)
 {
     Contract.Requires(format != null);
     Contract.Requires(arg0 != null);
     textbox.AppendText(String.Format(format, arg0) + Environment.NewLine);
     SetDefaultStyle(textbox);
 }
开发者ID:bobby1212,项目名称:VehicleGarage,代码行数:7,代码来源:RichTextBoxExtensions.cs

示例11: AppendLine

 public static void AppendLine(this TextBox textBox)
 {
     textBox.InvokeIfNeeded(delegate
     {
         textBox.AppendText("\r\n");
     }, InvocationMethod.Asynchronous);
 }
开发者ID:karlnet,项目名称:mpb,代码行数:7,代码来源:TextBoxExtensions.cs

示例12: AppendLine

 //function allowing to add strings in textBox1
 public static void AppendLine(this TextBox source, string value)
 {
     if (source.Text.Length == 0)
         source.Text = value;
     else
         source.AppendText("\r\n" + value);
 }
开发者ID:Bulikeri,项目名称:IPP,代码行数:8,代码来源:FormExtension.cs

示例13: AppendText

 public static async Task AppendText(this IFileInfo fileInfo, string text)
 {
     using (var writer = fileInfo.AppendText())
     {
         await writer.WriteAsync(text);
     }
 }
开发者ID:chris134pravin,项目名称:VisualStudio,代码行数:7,代码来源:FileExtensions.cs

示例14: AppendBold

 public static void AppendBold(this RichTextBox tb, string text)
 {
     Font orig = tb.SelectionFont;
     tb.SelectionFont = new Font(orig.FontFamily, orig.Size, FontStyle.Bold);
     tb.AppendText(text);
     tb.SelectionFont = orig;
 }
开发者ID:Winz,项目名称:MyWowTools,代码行数:7,代码来源:Extensions.cs

示例15: AppendColorBoldText

 /// <summary>
 /// Appends bold and colored text to the RichTextBox
 /// </summary>
 /// <param name="box">The RichTextBox</param>
 /// <param name="text">Text being added</param>
 /// <param name="color">Color of the text being added.</param>
 public static void AppendColorBoldText(this System.Windows.Forms.RichTextBox box, string text, System.Drawing.Color color)
 {
     box.SelectionFont = new Font(box.Font, FontStyle.Bold);
     box.SelectionColor = color;
     box.AppendText(text);
     box.SelectionFont = new Font(box.Font, FontStyle.Regular);
     box.SelectionColor = box.ForeColor;
 }
开发者ID:JohnsonNicholas,项目名称:aetherum-navigator,代码行数:14,代码来源:RichTextBoxExtensions.cs


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