當前位置:首頁 » 新型汽車 » brde5電動汽車

brde5電動汽車

發布時間: 2022-01-03 05:30:00

❶ C# 在richtextBox中插入表格的代碼片段怎麼寫~!急急急啊~!!

先在窗體類中聲明一個StringBuilder類型的對象,然後在button的單擊事件中編寫:
st.Append(@"\rtf1\fbidis\ansi\ansicpg936\deff0\deflang1033\deflangfe2052{\fonttbl{\f0\froman\fprq2\fcharset0 Times New Roman;}{\f1\fnil\fcharset134 \'cb\'ce\'cc\'e5;}}
{\colortbl ;\red0\green0\blue0;}
\viewkind4\uc1\trowd\trgaph108\trleft-108\trbrdrt\brdrs\brdrw10\brdrcf1 \trbrdrl\brdrs\brdrw10\brdrcf1 \trbrdrb\brdrs\brdrw10\brdrcf1 \trbrdrr\brdrs\brdrw10\brdrcf1 \clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx1596\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx3300\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx5004\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx6709\clbrdrt\brdrw15\brdrs\clbrdrl\brdrw15\brdrs\clbrdrb\brdrw15\brdrs\clbrdrr\brdrw15\brdrs \cellx8414\pard\intbl\ltrpar\kerning2\f0\fs21\cell\cell\cell\cell\cell\row
\intbl\cell\cell\cell\cell\cell\row
\intbl\cell\cell\cell\cell\cell\row
\intbl\cell\cell\cell\cell\cell\row
\pard\ltrpar\lang2052\kerning0\f1\fs18\par
");
richtextBox控制項的Rtf = "{"+st.ToString()+"}";這樣就可以了,你試試看。

❷ C#中怎麼在richtextbox中實現表格功能,最好有段源代碼

richtextbox本身就有表格顯示的功能。你在word中製作好表格,在復制到richtextbox中就Ok了。因為richtextbox支持rtf格式。rtf可以實現字體結構的不同程序間相互的轉移。
你要想點個什麼事件後產生表格,就要自己寫了。使用DHTML COM

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
richTextBox2.Rtf = "{\\rtf1\\ansi\\ansicpg936\\deff0\\deflang1033\\deflangfe2052{\\fonttbl{\\f0\\fnil\\fprq2\\fcharset134 \\'cb\\'ce\\'cc\\'e5;}{\\f1\\fnil\\fcharset134 \\'cb\\'ce\\'cc\\'e5;}}\\viewkind4\\uc1\\trowd\\trgaph108\\trleft-108\\trbrdrt\\brdrs\\brdrw10 \\trbrdrl\\brdrs\\brdrw10 \\trbrdrb\\brdrs\\brdrw10 \\trbrdrr\\brdrs\\brdrw10 \\clbrdrt\\brdrw15\\brdrs\\clbrdrl\\brdrw15\\brdrs\\clbrdrb\\brdrw15\\brdrs\\clbrdrr\\brdrw15\\brdrs \\cellx2732\\clbrdrt\\brdrw15\\brdrs\\clbrdrl\\brdrw15\\brdrs\\clbrdrb\\brdrw15\\brdrs\\clbrdrr\\brdrw15\\brdrs \\cellx5573\\clbrdrt\\brdrw15\\brdrs\\clbrdrl\\brdrw15\\brdrs\\clbrdrb\\brdrw15\\brdrs\\clbrdrr\\brdrw15\\brdrs \\cellx8414\\pard\\intbl\\kerning2\\f0\\fs21\\cell\\cell\\cell\\row\\intbl\\cell\\cell\\cell\\row\\pard\\lang2052\\kerning0\\f1\\fs18\\par}";
}

private void richTextBox1_TextChanged(object sender, EventArgs e)
{
//richTextBox2.Text = richTextBox1.Text;
richTextBox2.Text = richTextBox1.Rtf;
//toolStripStatusLabel1.Text = richTextBox1.Text;
}

private System.ComponentModel.IContainer components = null;

/// <summary>
/// 清理所有正在使用的資源。
/// </summary>
/// <param name="disposing">如果應釋放託管資源,為 true;否則為 false。</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}

#region Windows 窗體設計器生成的代碼

/// <summary>
/// 設計器支持所需的方法 - 不要
/// 使用代碼編輯器修改此方法的內容。
/// </summary>
private void InitializeComponent()
{
this.richTextBox1 = new System.Windows.Forms.RichTextBox();
this.richTextBox2 = new System.Windows.Forms.RichTextBox();
this.statusStrip1 = new System.Windows.Forms.StatusStrip();
this.toolStripStatusLabel1 = new System.Windows.Forms.ToolStripStatusLabel();
this.statusStrip1.SuspendLayout();
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.Location = new System.Drawing.Point(0, 0);
this.richTextBox1.Name = "richTextBox1";
this.richTextBox1.Size = new System.Drawing.Size(292, 161);
this.richTextBox1.TabIndex = 0;
this.richTextBox1.Text = "";
this.richTextBox1.TextChanged += new System.EventHandler(this.richTextBox1_TextChanged);
//
// richTextBox2
//
this.richTextBox2.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.richTextBox2.Location = new System.Drawing.Point(0, 157);
this.richTextBox2.Name = "richTextBox2";
this.richTextBox2.Size = new System.Drawing.Size(292, 91);
this.richTextBox2.TabIndex = 1;
this.richTextBox2.Text = "";
//
// statusStrip1
//
this.statusStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripStatusLabel1});
this.statusStrip1.Location = new System.Drawing.Point(0, 251);
this.statusStrip1.Name = "statusStrip1";
this.statusStrip1.Size = new System.Drawing.Size(292, 22);
this.statusStrip1.TabIndex = 2;
this.statusStrip1.Text = "statusStrip1";
//
// toolStripStatusLabel1
//
this.toolStripStatusLabel1.Name = "toolStripStatusLabel1";
this.toolStripStatusLabel1.Size = new System.Drawing.Size(131, 17);
this.toolStripStatusLabel1.Text = "toolStripStatusLabel1";
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.Add(this.statusStrip1);
this.Controls.Add(this.richTextBox2);
this.Controls.Add(this.richTextBox1);
this.Name = "Form1";
this.Text = "Form1";
this.statusStrip1.ResumeLayout(false);
this.statusStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();

}

#endregion

private System.Windows.Forms.RichTextBox richTextBox1;
private System.Windows.Forms.RichTextBox richTextBox2;
private System.Windows.Forms.StatusStrip statusStrip1;
private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabel1;

}
}

需要什麼(圖片,表格)就復制到框1里,框2就會顯示出代碼。這樣你可能會更明白吧!

熱點內容
二手抓機機動車價格 發布:2025-07-13 20:36:55 瀏覽:216
衢州計程車價格 發布:2025-07-13 20:21:08 瀏覽:604
2017版賓士商務車 發布:2025-07-13 20:13:23 瀏覽:899
九龍b型房車價格 發布:2025-07-13 20:11:56 瀏覽:495
皮卡用四驅後輪打滑是什麼原因 發布:2025-07-13 20:11:20 瀏覽:580
越野車和轎車哪個耐用 發布:2025-07-13 19:59:58 瀏覽:814
s90沃爾沃內飾 發布:2025-07-13 19:52:05 瀏覽:271
欣彭三輪電動車價格表 發布:2025-07-13 19:51:30 瀏覽:933
超輕越野摩托可拆卸 發布:2025-07-13 19:38:26 瀏覽:532
海南房車露營展 發布:2025-07-13 19:34:35 瀏覽:589