本文整理汇总了C#中System.Windows.Forms.RichTextBox类的典型用法代码示例。如果您正苦于以下问题:C# System.Windows.Forms.RichTextBox类的具体用法?C# System.Windows.Forms.RichTextBox怎么用?C# System.Windows.Forms.RichTextBox使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Windows.Forms.RichTextBox类属于命名空间,在下文中一共展示了System.Windows.Forms.RichTextBox类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InitializeComponent
/// <summary>
/// This method is required for Windows Forms designer support.
/// Do not change the method contents inside the source code editor. The Forms designer might
/// not be able to load this method if it was changed manually.
/// </summary>
private void InitializeComponent()
{
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.richTextBox1.BackColor = System.Drawing.Color.White;
this.richTextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None;
this.richTextBox1.Cursor = System.Windows.Forms.Cursors.Arrow;
this.richTextBox1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBox1.Location = new System.Drawing.Point(13, 13);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.ReadOnly = true;
this.richTextBox1.Size = new System.Drawing.Size(490, 273);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// HelpForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(515, 298);
this.Controls.Add(this.richTextBox1);
this.Name = "HelpForm";
this.Text = "HelpForm";
this.Load += new System.EventHandler(this.OnLoad);
this.ResumeLayout(false);
}
示例2: ToText
public override string ToText(Subtitle subtitle, string title)
{
var sb = new StringBuilder();
sb.AppendLine(title);
sb.AppendLine(@"1ab
23/03/2012
03/05/2012
**:**:**.**
01:00:00.00
**:**:**.**
**:**:**.**
01:01:01.12
01:02:30.00
01:02:54.01
**:**:**.**
**:**:**.**
01:19:33.08
");
int count = 1;
foreach (Paragraph p in subtitle.Paragraphs)
{
sb.AppendLine(string.Format("{0}: {1} {2}\r\n{3}", count.ToString(CultureInfo.InvariantCulture).PadLeft(9, ' '), MakeTimeCode(p.StartTime), MakeTimeCode(p.EndTime), p.Text));
count++;
}
var rtBox = new System.Windows.Forms.RichTextBox { Text = sb.ToString().Trim() };
return rtBox.Rtf;
}
示例3: ConvertStringToRtf
public static string ConvertStringToRtf(string str)
{
System.Windows.Forms.RichTextBox richTextBox = new System.Windows.Forms.RichTextBox();
richTextBox.Text = str;
richTextBox.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
return richTextBox.Rtf;
}
示例4: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.listBoxMessages = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// listBoxMessages
//
this.listBoxMessages.BackColor = System.Drawing.SystemColors.Info;
this.listBoxMessages.Dock = System.Windows.Forms.DockStyle.Fill;
this.listBoxMessages.Font = new System.Drawing.Font("Arial", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.listBoxMessages.Location = new System.Drawing.Point(0, 0);
this.listBoxMessages.Name = "listBoxMessages";
this.listBoxMessages.ReadOnly = true;
this.listBoxMessages.Size = new System.Drawing.Size(723, 377);
this.listBoxMessages.TabIndex = 0;
this.listBoxMessages.Tag = "";
this.listBoxMessages.Text = "";
//
// LoggerView
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.listBoxMessages);
this.BackColor = System.Drawing.SystemColors.Info;
this.Name = "LoggerView";
this.Size = new System.Drawing.Size(723, 377);
this.ResumeLayout(false);
}
示例5: UDPMulticastListener
public UDPMulticastListener(int port, string address, System.Windows.Forms.RichTextBox rich, SerialPort vport)
{
this.port = port;
this.address = address;
this.rich = rich;
this.vport = vport;
}
示例6: ToText
public override string ToText(Subtitle subtitle, string title)
{
var sb = new StringBuilder();
sb.AppendLine("#\tAppearance\tCaption\t");
sb.AppendLine();
int count = 1;
for (int i = 0; i < subtitle.Paragraphs.Count; i++)
{
Paragraph p = subtitle.Paragraphs[i];
string text = Utilities.RemoveHtmlTags(p.Text);
sb.AppendLine(string.Format("{0}\t{1}\t{2}\t", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.StartTime), text));
sb.AppendLine("\t\t\t\t");
Paragraph next = subtitle.GetParagraphOrDefault(i + 1);
if (next == null || Math.Abs(p.EndTime.TotalMilliseconds - next.StartTime.TotalMilliseconds) > 50)
{
count++;
sb.AppendLine(string.Format("{0}\t{1}", count.ToString().PadLeft(5, ' '), MakeTimeCode(p.EndTime)));
}
count++;
}
var rtBox = new System.Windows.Forms.RichTextBox();
rtBox.Text = sb.ToString();
string rtf = rtBox.Rtf;
rtBox.Dispose();
return rtf;
}
示例7: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Abount));
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(441, 153);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = resources.GetString("richTextBox1.Text");
//
// Abount
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(441, 153);
this.Controls.Add(this.richTextBox1);
this.Name = "Abount";
this.Text = "Abount";
this.ResumeLayout(false);
}
示例8: ConvertRtfTextInSTAThread
private void ConvertRtfTextInSTAThread(object rtf)
{
var threadData = rtf as ConvertRtfThreadData;
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
rtBox.Rtf = threadData.RtfText;
threadData.HtmlText = rtBox.Text;
}
示例9: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.RTB = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// RTB
//
this.RTB.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.RTB.Location = new System.Drawing.Point(0, 1);
this.RTB.Name = "RTB";
this.RTB.Size = new System.Drawing.Size(784, 475);
this.RTB.TabIndex = 0;
this.RTB.Text = "";
this.RTB.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.RTB_LinkClicked);
this.RTB.MouseClick += new System.Windows.Forms.MouseEventHandler(this.RTB_MouseClick);
this.RTB.KeyDown += new System.Windows.Forms.KeyEventHandler(this.RTB_KeyDown);
this.RTB.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.RTB_KeyPress);
this.RTB.MouseMove += new System.Windows.Forms.MouseEventHandler(this.RTB_MouseMove);
//
// HelpForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(784, 474);
this.Controls.Add(this.RTB);
this.Name = "HelpForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "DH ShapeMaker Help";
this.Load += new System.EventHandler(this.HelpForm_Load);
this.ResumeLayout(false);
}
示例10: Main
static void Main()
{
// If your RTF file isn't in the same folder as the .exe file for the project,
// specify the path to the file in the following assignment statement.
string path = @"test.rtf";
//Create the RichTextBox. (Requires a reference to System.Windows.Forms.)
System.Windows.Forms.RichTextBox rtBox = new System.Windows.Forms.RichTextBox();
// Get the contents of the RTF file. When the contents of the file are
// stored in the string (rtfText), the contents are encoded as UTF-16.
string rtfText = System.IO.File.ReadAllText(path);
// Display the RTF text. This should look like the contents of your file.
System.Windows.Forms.MessageBox.Show(rtfText);
// Use the RichTextBox to convert the RTF code to plain text.
rtBox.Rtf = rtfText;
string plainText = rtBox.Text;
// Display the plain text in a MessageBox because the console can't
// display the Greek letters. You should see the following result:
// The Greek word for "psyche" is spelled ψυχή. The Greek letters are
// encoded in Unicode.
// These characters are from the extended ASCII character set (Windows
// code page 1252): âäӑå
System.Windows.Forms.MessageBox.Show(plainText);
// Output the plain text to a file, encoded as UTF-8.
System.IO.File.WriteAllText(@"output.txt", plainText);
}
开发者ID:terryjintry,项目名称:OLSource1,代码行数:31,代码来源:how-to--convert-rtf-to-plain-text--csharp-programming-guide-_1.cs
示例11: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptingAutopilotForm));
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// richTextBox1
//
this.richTextBox1.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBox1.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(292, 382);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
//
// ScriptingAutopilotForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 382);
this.Controls.Add(this.richTextBox1);
this.DockAreas = ((WeifenLuo.WinFormsUI.Docking.DockAreas)(((((WeifenLuo.WinFormsUI.Docking.DockAreas.Float | WeifenLuo.WinFormsUI.Docking.DockAreas.DockLeft)
| WeifenLuo.WinFormsUI.Docking.DockAreas.DockRight)
| WeifenLuo.WinFormsUI.Docking.DockAreas.DockTop)
| WeifenLuo.WinFormsUI.Docking.DockAreas.DockBottom)));
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Name = "ScriptingAutopilotForm";
this.ShowHint = WeifenLuo.WinFormsUI.Docking.DockState.DockBottom;
this.Text = "ScriptingAutopilot";
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptingAutopilotForm_FormClosing_1);
this.ResumeLayout(false);
}
示例12: LoadSubtitle
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
{
_errorCount = 0;
var sb = new StringBuilder();
foreach (string line in lines)
sb.AppendLine(line);
string rtf = sb.ToString().Trim();
if (!rtf.StartsWith("{\\rtf"))
return;
var rtBox = new System.Windows.Forms.RichTextBox();
try
{
rtBox.Rtf = rtf;
}
catch (Exception exception)
{
System.Diagnostics.Debug.WriteLine(exception.Message);
return;
}
string text = rtBox.Text;
rtBox.Dispose();
LoadF4TextSubtitle(subtitle, text);
}
示例13: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.richTextBoxConsole = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// richTextBoxConsole
//
this.richTextBoxConsole.AcceptsTab = true;
this.richTextBoxConsole.BackColor = System.Drawing.Color.Black;
this.richTextBoxConsole.Dock = System.Windows.Forms.DockStyle.Fill;
this.richTextBoxConsole.Font = new System.Drawing.Font("Consolas", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.richTextBoxConsole.ForeColor = System.Drawing.Color.White;
this.richTextBoxConsole.Location = new System.Drawing.Point(0, 0);
this.richTextBoxConsole.Name = "richTextBoxConsole";
this.richTextBoxConsole.ReadOnly = true;
this.richTextBoxConsole.Size = new System.Drawing.Size(150, 150);
this.richTextBoxConsole.TabIndex = 0;
this.richTextBoxConsole.Text = "";
this.richTextBoxConsole.TextChanged += new System.EventHandler(this.richTextBoxConsole_TextChanged);
//
// ConsoleControl
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.Controls.Add(this.richTextBoxConsole);
this.Name = "ConsoleControl";
this.ResumeLayout(false);
}
示例14: LoadSubtitle
public override void LoadSubtitle(Subtitle subtitle, List<string> lines, string fileName)
{
_errorCount = 0;
var sb = new StringBuilder();
foreach (string line in lines)
sb.AppendLine(line);
string rtf = sb.ToString().Trim();
if (!rtf.StartsWith("{\\rtf"))
return;
string[] arr = null;
var rtBox = new System.Windows.Forms.RichTextBox();
try
{
rtBox.Rtf = rtf;
arr = rtBox.Text.Replace("\r", string.Empty).Split('\n');
}
catch (Exception exception)
{
System.Diagnostics.Debug.WriteLine(exception.Message);
return;
}
finally
{
rtBox.Dispose();
}
lines = new List<string>();
foreach (string s in arr)
lines.Add(s);
base.LoadSubtitle(subtitle, lines, fileName);
}
示例15: InitializeComponent
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.rb = new System.Windows.Forms.RichTextBox();
this.SuspendLayout();
//
// rb
//
this.rb.Dock = System.Windows.Forms.DockStyle.Fill;
this.rb.Location = new System.Drawing.Point(0, 0);
this.rb.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.rb.Name = "rb";
this.rb.ReadOnly = true;
this.rb.Size = new System.Drawing.Size(663, 406);
this.rb.TabIndex = 0;
this.rb.Text = "";
this.rb.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.rb_LinkClicked);
//
// helpForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 16F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(663, 406);
this.Controls.Add(this.rb);
this.Font = new System.Drawing.Font("Microsoft Sans Serif", 10F);
this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4);
this.Name = "helpForm";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Справка";
this.ResumeLayout(false);
}