本文整理汇总了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));
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例11: AppendLine
public static void AppendLine(this TextBox textBox)
{
textBox.InvokeIfNeeded(delegate
{
textBox.AppendText("\r\n");
}, InvocationMethod.Asynchronous);
}
示例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);
}
示例13: AppendText
public static async Task AppendText(this IFileInfo fileInfo, string text)
{
using (var writer = fileInfo.AppendText())
{
await writer.WriteAsync(text);
}
}
示例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;
}
示例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;
}