C#的记事本代码,要简单点的就好!

 我来答
带泪的紫藤花
2010-12-21 · TA获得超过2665个赞
知道小有建树答主
回答量:486
采纳率:100%
帮助的人:202万
展开全部
这是我做的一个简单的记事本,功能比较简单,觉得挺适合你的,代码在下面,如果有什么不懂得话可以百度HI我~~~
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 记事本
{
public partial class MdiChild : Form
{
public MdiChild()
{
InitializeComponent();
}

private void 剪切XToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Cut();
}

private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Copy();
}

private void 粘贴VToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Paste();
}

private void 颜色ToolStripMenuItem_Click(object sender, EventArgs e)
{
ColorDialog colordig = new ColorDialog();
DialogResult dlgresult;
dlgresult = colordig.ShowDialog();
if (dlgresult == DialogResult.OK)
richTextBox1.SelectionColor = colordig.Color;
}

private void 背景色ToolStripMenuItem_Click(object sender, EventArgs e)
{
ColorDialog ff = new ColorDialog();
DialogResult dlgresult;
dlgresult = ff.ShowDialog();
if (dlgresult == DialogResult.OK)
richTextBox1.BackColor = ff.Color;
}

private void 字体ToolStripMenuItem_Click(object sender, EventArgs e)
{
FontDialog fontdig = new FontDialog();
DialogResult dlgresult;
dlgresult = fontdig.ShowDialog();
if (dlgresult == DialogResult.OK)
richTextBox1.SelectionFont = fontdig.Font;
}

private void 加粗ToolStripMenuItem1_Click(object sender, EventArgs e)
{
Font newfont = new Font(richTextBox1.SelectionFont, (richTextBox1.SelectionFont.Bold ? richTextBox1.SelectionFont.Style & ~FontStyle.Bold : richTextBox1.SelectionFont.Style | FontStyle.Bold));
richTextBox1.SelectionFont = newfont;
}

private void 斜体ToolStripMenuItem_Click(object sender, EventArgs e)
{
Font newfont=new Font(richTextBox1.SelectionFont,(richTextBox1.SelectionFont.Italic?richTextBox1.SelectionFont.Style&~FontStyle.Italic:richTextBox1.SelectionFont.Style|FontStyle.Italic));
richTextBox1.SelectionFont=newfont;

}

private void 下划线ToolStripMenuItem_Click(object sender, EventArgs e)
{
Font newfont = new Font(richTextBox1.SelectionFont, (richTextBox1.SelectionFont.Underline ? richTextBox1.SelectionFont.Style & ~FontStyle.Underline : richTextBox1.SelectionFont.Style | FontStyle.Underline));
richTextBox1.SelectionFont = newfont;
}

private void 剪切ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Cut();
}

private void 复制ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Copy();
}

private void 粘贴ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.richTextBox1.Paste();
}

private void 加粗ToolStripMenuItem2_Click(object sender, EventArgs e)
{

}

private void toolStripMenuItem2_Click(object sender, EventArgs e)
{
this.richTextBox1.ZoomFactor = 0.75f;
}

private void toolStripMenuItem3_Click(object sender, EventArgs e)
{
this.richTextBox1.ZoomFactor = 1f;
}

private void toolStripMenuItem4_Click(object sender, EventArgs e)
{
this.richTextBox1.ZoomFactor = 1.5f;
}

private void toolStripMenuItem5_Click(object sender, EventArgs e)
{
this.richTextBox1.ZoomFactor = 2f;
}

private void toolStripMenuItem6_Click(object sender, EventArgs e)
{
this.richTextBox1.ZoomFactor = 3.0f;
}

private void richTextBox1_LinkClicked(object sender, LinkClickedEventArgs e)
{
System.Diagnostics.Process.Start("IExplore", e.LinkText);
}

}
}
daxia1998
2010-12-13 · 超过24用户采纳过TA的回答
知道答主
回答量:65
采纳率:0%
帮助的人:0
展开全部
晕了,msdn中就有,
本回答被提问者和网友采纳
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
百度网友c109e3e
2010-12-13 · 超过12用户采纳过TA的回答
知道答主
回答量:145
采纳率:0%
帮助的人:57.3万
展开全部
taobao .
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
收起 更多回答(1)
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式