66118833 发表于 2009-6-24 13:05:48

c# 记事本实现代码

编辑模块只实现了全选和时间2个功能,自动换行的功能还没写。

  如果需要全部源码的请留言或者发邮件至henanlinzhoulcl@163.com

  版本:1.0

  主要代码如下:

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

namespace MyNotePad
{
public partial class MyNotePad : Form
{
public MyNotePad()
{
InitializeComponent();
this.toolStripStatusLabel3.Text = DateTime.Now.DayOfWeek.ToString();
}

private void textBox1_KeyPress(object sender, KeyPressEventArgs e)
{
//textBox1.Text += e.KeyChar;
}

private void 退出ToolStripMenuItem_Click(object sender, EventArgs e)
{
Application.Exit();
}

private void 日期ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.textBox1.SelectedText != "")
{
this.textBox1.SelectedText = DateTime.Now.ToString();
}
else
{
this.textBox1.Text += DateTime.Now;
}
}

private void timer1_Tick(object sender, EventArgs e)
{
this.toolStripStatusLabel1.Text = "现在时间是:" + DateTime.Now.ToString();
}

private void 状态栏ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (this.statusStrip1.Visible == false)
{
this.statusStrip1.Visible = true;
}
else
{
this.statusStrip1.Visible = false;
this.textBox1.Height += 10;
}
}

private void 关于MyNotePadAToolStripMenuItem_Click(object sender, EventArgs e)
{
About ab = new About();
ab.Show();
}

private void 全选ToolStripMenuItem_Click(object sender, EventArgs e)
{
this.textBox1.SelectAll();
}

private void 字体ToolStripMenuItem_Click(object sender, EventArgs e)
{
if (fontDialog1.ShowDialog() == DialogResult.OK)
{
textBox1.Font = fontDialog1.Font;
页: [1]
查看完整版本: c# 记事本实现代码