• 大小: 94KB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2021-05-17
  • 语言: C#
  • 标签:

资源简介

使用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;
using System.IO;

namespace homework_txt
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void toolStripTextBox1_Click(object sender EventArgs e)
        {

        }

        private void toolStripButton1_Click(object sender EventArgs e)
        {

        }

        private void toolStripButton2_Click(object sender EventArgs e)
        {
            if (fontDialog1.ShowDialog() == DialogResult.OK)
            {
                richTextBox1.SelectionFont = fontDialog1.Font;
            }
            else
            { 
            //haiyou 
            }
        }

        private void toolStripButton1_Click_1(object sender EventArgs e)
        {
            if (colorDialog1.ShowDialog()==DialogResult.OK)
            {
                richTextBox1.SelectionColor = colorDialog1.Color;
            }
        }

        private void 打开OToolStripButton_Click(object sender EventArgs e)//打开txt文档
        {
            openFileDialog1.Filter = “文本文档(*.txt)|*.txt“;//打开类型
            if (openFileDialog1.ShowDialog()==DialogResult.OK)
            {
                richTextBox1.Text = string.Empty;
                StreamReader dakai = new StreamReader(openFileDialog1.FileName);
                richTextBox1.Text = dakai.ReadToEnd();
                dakai.Close();//关闭输入流
            }
        }

        private void 保存SToolStripButton_Click(object sender EventArgs e)
        {
            richTextBox1.SaveFile(“NewTxt.txt“);
        }

        private void 打开ToolStripMenuItem_Click(object sender EventArgs e)//打开txt文档
        {
            openFileDialog1.Filter = “文本(*.txt)|*.txt“;
            if (openFileDialog1.ShowDialog()==DialogResult.OK)
            {
                richTextBox1.Text = string.Empty;
                StreamReader dakai = new StreamReader(openFileDialog1.FileName);
                richTextBox1.Text = dakai.ReadToEnd();
                dakai.Close();
            }
        }

        private void 保存ToolStripMenuItem_Click(object sender EventArgs e)
        {
            richTextBox1.SaveFile(“NewTxt.txt“);
        }

        private void 另存为ToolStripMenuItem_Click(object sender EventArgs e)
        {
            if (richTextBox1.Text==string.Empty)
            {
                MessageBox.Show(“您还没有输入内容!“);
            } 
            else
            {
                saveFileDialog1.Filter = “文本文件(*.txt)|.txt“;
                if (saveFileDialog1.ShowDialog()==DialogResult.OK)
                {
                    StreamWriter lcw = new StreamWriter(saveFileDialog1.FileName true);
                    lcw.WriteLine(richTextBox1.Text);
                    lcw.Close();

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2011-05-08 14:59  2009010587郭泽渊\
     目录           0  2011-05-08 14:38  2009010587郭泽渊\homework-txt\
     文件         878  2011-05-08 14:36  2009010587郭泽渊\homework-txt.sln
     文件       20480  2011-05-08 18:50  2009010587郭泽渊\homework-txt.suo
     目录           0  2011-05-08 14:36  2009010587郭泽渊\homework-txt\bin\
     目录           0  2011-05-08 15:53  2009010587郭泽渊\homework-txt\bin\Debug\
     文件       32256  2011-05-08 18:50  2009010587郭泽渊\homework-txt\bin\Debug\homework-txt.exe
     文件       38400  2011-05-08 18:50  2009010587郭泽渊\homework-txt\bin\Debug\homework-txt.pdb
     文件       11600  2011-05-08 18:50  2009010587郭泽渊\homework-txt\bin\Debug\homework-txt.vshost.exe
     文件         490  2010-03-17 22:39  2009010587郭泽渊\homework-txt\bin\Debug\homework-txt.vshost.exe.manifest
     文件         152  2011-05-08 16:58  2009010587郭泽渊\homework-txt\bin\Debug\NewTxt.txt
     文件        7113  2011-05-08 18:37  2009010587郭泽渊\homework-txt\Form1.cs
     文件       36609  2011-05-08 18:37  2009010587郭泽渊\homework-txt\Form1.Designer.cs
     文件       19873  2011-05-08 18:37  2009010587郭泽渊\homework-txt\Form1.resx
     文件        3683  2011-05-08 15:23  2009010587郭泽渊\homework-txt\homework-txt.csproj
     目录           0  2011-05-08 14:36  2009010587郭泽渊\homework-txt\obj\
     目录           0  2011-05-08 14:36  2009010587郭泽渊\homework-txt\obj\x86\
     目录           0  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\
     文件        4440  2011-05-08 15:45  2009010587郭泽渊\homework-txt\obj\x86\Debug\DesignTimeResolveAssemblyReferences.cache
     文件        6214  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\DesignTimeResolveAssemblyReferencesInput.cache
     文件         824  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\GenerateResource.read.1.tlog
     文件        1090  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\GenerateResource.write.1.tlog
     文件        1355  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\homework-txt.csproj.FileListAbsolute.txt
     文件       32256  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\homework-txt.exe
     文件       38400  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\homework-txt.pdb
     文件        9533  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\homework_txt.Form1.resources
     文件         180  2011-05-08 18:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\homework_txt.Properties.Resources.resources
     文件        7897  2011-05-08 15:50  2009010587郭泽渊\homework-txt\obj\x86\Debug\ResolveAssemblyReference.cache
     目录           0  2011-05-08 14:36  2009010587郭泽渊\homework-txt\obj\x86\Debug\TempPE\
     文件         493  2011-05-08 14:36  2009010587郭泽渊\homework-txt\Program.cs
     目录           0  2011-05-08 14:36  2009010587郭泽渊\homework-txt\Properties\
............此处省略9个文件信息

评论

共有 条评论

相关资源