Winform 记事本

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 Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void 退出XToolStripMenuItem_Click(object sender, EventArgs e)
        {
            this.Close();//鼠标点击实现退出
        }

        private void 撤消UToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Undo();//鼠标点击实现输入文字的撤销
        }

        private void 剪切TToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Cut();//鼠标点击实现文字剪切
        }

        private void 复制CToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Copy();//鼠标点击实现文字复制
        }

        private void 粘贴PToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.Paste();//鼠标点击实现文字粘贴
        }

        private void 全选AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            textBox1.SelectAll();//鼠标点击实现文字全选
        }

        private void textBox1_TextChanged(object sender, EventArgs e)
        {
            string s = textBox1.TextLength.ToString();//记录并显示字符的数量,先将这个记事本文本的长度以字符串的形式赋值到变量s中
            toolStripStatusLabel2.Text = s;//底部菜单栏文本控件文本的值等于记事本文本的长度
        }
    }
}
posted @ 2016-06-30 00:28  一人饮酒醉(SeVen❤)  阅读(179)  评论(0编辑  收藏  举报