• 大小: 23KB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2021-05-29
  • 语言: C#
  • 标签: 记事本  简易word  

资源简介

这是一个基于C# 2008编写的简易word办公程序,其实是一个写字板(记事本)程序,实现了一些基本的word操作功能,感谢作者:滕俊辉,源代码仅供参考,请勿用于商业。

资源截图

代码片段和文件信息

// Downloads By http://down.liehuo.net
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace 记事本
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        public RichTextBox RTB
        {
            get
            {
                NewForm f = (NewForm)this.ActiveMdiChild;
                if (f == null) return null;
                else return f.richTextBox1;
            }

        }
        private string File_name; // 存放文件名
        private bool ModifyStatus; // 编辑状态
        private void Set_Tital()
        {
            this.Text = “文本编辑器 -“;
            if (File_name == ““)
                this.Text = this.Text + “未命名“;
            else
                this.Text = this.Text + File_name;
        }


        private void cm_Cut_Click(object sender EventArgs e)
        {
            this.RTB.Cut();
        }

        private void cm_Pasta_Click(object sender EventArgs e)
        {
            this.RTB.Paste();
        }

        private void 左ToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.RTB.SelectionAlignment = HorizontalAlignment.Left;
        }

        private void 中ToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.RTB.SelectionAlignment = HorizontalAlignment.Center;
        }

        private void 右ToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.RTB.SelectionAlignment = HorizontalAlignment.Right;
        }

        private void contextMenuStrip1_Opening(object sender CancelEventArgs e)
        {

            //MessageBox.Show(this.contextMenuStrip1.SourceControl.GetType().Name);
            switch (this.contextMenuStrip1.SourceControl.GetType().Name)
            {
                case “MenuStrip“:
                    this.cm_Cut.Enabled = false;
                    this.cm_Paste.Enabled = false;
                    this.cm_Align.Enabled = true;
                    break;
                case “RichTextBox“:
                    this.cm_Cut.Enabled = true;
                    this.cm_Paste.Enabled = false;
                    this.cm_Align.Enabled = true;
                    break;
            }
        }

        private void 撤销ToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.RTB.Undo();
        }

        private void 重复ToolStripMenuItem_Click(object sender EventArgs e)
        {
            this.RTB.Redo();
        }

        private void timer1_Tick(object sender EventArgs e)
        {
            this.systime.Text = DateTime.Now.ToString();
        }

        private void 新建NToolStripMenuItem_Click(object sender EventArgs e)
        {
            //if (RTB == null) return;
            NewForm f = new NewForm();
       

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

     文件         41  2011-01-01 13:41  liehuo.net.txt

     文件        917  2010-11-15 17:18  记事本.sln

     文件       7260  2011-03-27 16:43  记事本\Form1.cs

     文件      42044  2011-03-27 16:43  记事本\Form1.Designer.cs

     文件      19731  2010-12-26 20:48  记事本\Form1.resx

     文件        472  2011-03-27 16:43  记事本\NewForm.cs

     文件       2127  2011-03-27 16:43  记事本\NewForm.Designer.cs

     文件       5814  2010-11-01 15:55  记事本\NewForm.resx

     文件        510  2011-03-27 16:43  记事本\Program.cs

     文件       1166  2010-10-25 15:21  记事本\Properties\AssemblyInfo.cs

     文件       2842  2010-11-15 17:18  记事本\Properties\Resources.Designer.cs

     文件       5612  2010-10-25 15:21  记事本\Properties\Resources.resx

     文件       1107  2010-11-15 17:18  记事本\Properties\Settings.Designer.cs

     文件        249  2010-10-25 15:21  记事本\Properties\Settings.settings

     文件       3782  2010-11-15 17:18  记事本\记事本.csproj

     文件        135  2010-08-22 09:06  down.liehuo.net.url

     目录          0  2011-03-27 16:42  记事本\bin

     目录          0  2011-03-27 16:42  记事本\obj

     目录          0  2010-12-27 17:14  记事本\Properties

     目录          0  2010-12-27 17:14  记事本

----------- ---------  ---------- -----  ----

                93809                    20


评论

共有 条评论