Notepad_2/Form1.cs

(开头部分) 9KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace Notepad_2
{
    public partial class frmNotepad : Form
    {
        public frmNotepad()
        {
            InitializeComponent();
        }

        bool s = false;
        bool b = true;

        private void richTextBox1_TextChanged(object sender, EventArgs e)
        {
            // 文本被修改后,设置s为false,表示文件未保存
            s = false;
        }
        //新建
        private void tsmiNew_Click(object sender, EventArgs e)
        {
            //判断当前文件是否从磁盘打开,或者新建是文档不为空,并且文件为被保存
            if (b == true || rtxtNotepad.Text.Trim() != "")
            {
                if (s == false)
                {
                    string result;
                    result = MessageBox.Show("文件尚未保存,是否保存?", "保存文件", MessageBoxButtons.YesNoCancel).ToString();
                    switch(result)
                    {
                        case "Yes":
                            //若文件是从磁盘打开的
                            if (b == true)
                            {
                                //按文件打开的路径保存文件
                                rtxtNotepad.SaveFile(odlgNotepad.FileName);
                            }
                            //若文件不是从磁盘打开的
                            else if(sdlgNotepad.ShowDialog()==DialogResult.OK)
                            {
                                rtxtNotepad.SaveFile(sdlgNotepad.FileName);
                            }
                            s = true;
                            rtxtNotepad.Text = "";
                            break;
                        case "No":
                            b = false;
                            rtxtNotepad.Text = "";
                            break;
                    }
                }
后面还有 249 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 算力/个。 规则说明

AI 解读 AI

登录后可用,每次 10 算力,解读结果公开显示在下面。

还没有人解读过这个文件。