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

资源简介

本软件用vs2008完成,使用C#编程语言。 本软件具有的以下功能:文件(打开、关闭、新建、保存、另存为、退出)、编辑(复制、粘贴、剪切、撤销、恢复、全选、查找和替换)、格式(字体、颜色、自动换行)。

资源截图

代码片段和文件信息

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 DocumentEditor
{
    public partial class Document : Form
    {
        public Document()
        {
            InitializeComponent();
        }

        public static int newtxt_count = 1;
        public static int childtxt_count = 0;
        public NewTxt child_Form = new NewTxt();

        private void 新建NToolStripButton_Click(object sender EventArgs e)
        {
            NewTxt newtxt = new NewTxt();
            newtxt.MdiParent = this;
            newtxt.Text = “新建文档“ + newtxt_count.ToString()+ “.txt“;
            newtxt.Name = ““;
            newtxt_count++;
            newtxt.Show();
        }

        private void 打开OToolStripButton_Click(object sender EventArgs e)
        {
            NewTxt newtxt = new NewTxt();
            newtxt.MdiParent = this;
            this.child_Form = newtxt;
            openFileDialog1.Filter = “文本文档(*.txt)|*.txt|RTF格式(*.rtf)|*.rtf|All file(*.*)|*.*“;
            openFileDialog1.title = “打开“;
            if (openFileDialog1.ShowDialog() == DialogResult.OK)
            {
                newtxt.Text = openFileDialog1.FileName;
                newtxt.Name = openFileDialog1.FileName;
                newtxt.richTextBox1.Clear();
                try
                {/*****************/
                    if (openFileDialog1.FileName.EndsWith(“rtf“))
                        newtxt.richTextBox1.LoadFile(openFileDialog1.FileName RichTextBoxStreamType.RichText);
                    else
                        newtxt.richTextBox1.LoadFile(openFileDialog1.FileName RichTextBoxStreamType.PlainText);
                    newtxt.MdiParent = this;
                    // 创建一个子窗口对象,用来实现打开一个文档,并设置该子窗口为活动窗口
                    newtxt.filePath = openFileDialog1.FileName;
                    FileInfo finfo = new FileInfo(newtxt.filePath);
                    newtxt.fileName = finfo.Name;
                    //childtxt.Name = childtxt.fileName;
                    newtxt.Text = newtxt.fileName;
                    newtxt.Show();
                    newtxt.textChanged = false;//打开时,文本也有变化,故设置打开时没变化
                    childtxt_count++;//状态栏
                   // this.toolStripStatusLabel4.Text = “打开的窗口有“ + child_count.ToString() + “个!“;
                }
                catch
                {
                    string Message = “Cannot Open“ + openFileDialog1.FileName;
                    MessageBox.Show(Message “打开文件错误“ MessageBoxButtons.OK
                        MessageBoxIcon.Error);
                    return;
                }
            }
        }

        private void 另存为ToolStripMenuItem_Click(object sender EventArgs e)
        {
            try
            {
                saveFileDialog1.Filter = “文本文件(*.txt)|*.txt|rtf格式(*.rtf)|*.rtf|所有文件(*

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件      39424  2010-04-19 16:49  DocumentEditor\DocumentEditor\bin\Debug\DocumentEditor.exe

     文件      67072  2010-04-19 16:49  DocumentEditor\DocumentEditor\bin\Debug\DocumentEditor.pdb

     文件      14328  2010-04-19 16:55  DocumentEditor\DocumentEditor\bin\Debug\DocumentEditor.vshost.exe

     文件        490  2007-07-21 01:33  DocumentEditor\DocumentEditor\bin\Debug\DocumentEditor.vshost.exe.manifest

     文件         12  2010-01-06 08:15  DocumentEditor\DocumentEditor\bin\Debug\NewTxt

     文件        156  2010-01-05 09:50  DocumentEditor\DocumentEditor\bin\Debug\新建文档1

     文件      13018  2010-01-12 18:45  DocumentEditor\DocumentEditor\Document.cs

     文件      30214  2010-01-12 18:45  DocumentEditor\DocumentEditor\Document.Designer.cs

     文件      20560  2010-01-12 18:45  DocumentEditor\DocumentEditor\Document.resx

     文件       5849  2010-01-12 18:42  DocumentEditor\DocumentEditor\DocumentEditor.csproj

     文件        486  2010-01-12 18:42  DocumentEditor\DocumentEditor\DocumentEditor.csproj.user

     文件       5649  2010-01-07 08:04  DocumentEditor\DocumentEditor\Form1.cs

     文件       6610  2010-01-07 08:04  DocumentEditor\DocumentEditor\Form1.Designer.cs

     文件       6223  2010-01-07 08:04  DocumentEditor\DocumentEditor\Form1.resx

     文件        355  2010-04-19 16:49  DocumentEditor\DocumentEditor\Form2.cs

     文件       4546  2010-04-19 16:49  DocumentEditor\DocumentEditor\Form2.Designer.cs

     文件       5814  2010-04-19 16:49  DocumentEditor\DocumentEditor\Form2.resx

     文件       2564  2010-04-19 16:55  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.csproj.FileListAbsolute.txt

     文件       1025  2010-04-19 16:49  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.csproj.GenerateResource.Cache

     文件      10035  2010-01-12 18:45  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.Document.resources

     文件      39424  2010-04-19 16:49  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.exe

     文件        180  2010-04-19 16:49  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.Form2.resources

     文件        180  2010-01-12 18:42  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.NewTxt.resources

     文件      67072  2010-04-19 16:49  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.pdb

     文件        180  2010-01-12 18:42  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.Properties.Resources.resources

     文件        180  2010-01-12 18:42  DocumentEditor\DocumentEditor\obj\Debug\DocumentEditor.Search.resources

     文件       4608  2010-01-12 18:38  DocumentEditor\DocumentEditor\obj\Debug\TempPE\Properties.Resources.Designer.cs.dll

     文件        406  2010-01-07 10:54  DocumentEditor\DocumentEditor\obj\DocumentEditor.csproj.FileList.txt

     文件        476  2009-12-31 15:08  DocumentEditor\DocumentEditor\Program.cs

     文件       1224  2009-12-31 14:29  DocumentEditor\DocumentEditor\Properties\AssemblyInfo.cs

............此处省略21个文件信息

评论

共有 条评论

相关资源