WPE|52wpe|我爱WPE

 找回密码
 注册会员
搜索
  • 1625查看
  • 0回复

[经验分享] c# 记事本实现代码

主题

好友

4116

积分

论坛元老

发表于 2009-6-24 13:05:48 |显示全部楼层
编辑模块只实现了全选和时间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;

快速发帖

您需要登录后才可以回帖 登录 | 注册会员

手机版|Archiver|WPE|52wpe|我爱WPE ( 闽ICP备15009081号 )

GMT+8, 2024-5-18 16:13 , Processed in 0.061084 second(s), 16 queries .

返回顶部