Exemplo n.º 1
0
Arquivo: Form1.cs Projeto: llxq/.net
        private void 另存为AToolStripMenuItem_Click(object sender, EventArgs e)
        {
            Baocun bc = new Baocun();

            bc.Get(richTextBox1);
            save = true;
        }
Exemplo n.º 2
0
Arquivo: Form1.cs Projeto: llxq/.net
        private void 打开OToolStripMenuItem_Click(object sender, EventArgs e)
        {
            dk = false;
            if (save == false)
            {
                DialogResult dr = MessageBox.Show("未保存文件,是否保存?", "提示", MessageBoxButtons.YesNo);
                switch (dr)
                {
                case DialogResult.Yes:
                    Baocun bc = new Baocun();
                    bc.Get(richTextBox1);
                    Open o = new Open();
                    o.Set(richTextBox1);
                    string str = o.PathOPen;
                    save = true;
                    break;

                case DialogResult.No:
                    richTextBox1.Clear();
                    Open op = new Open();
                    op.Set(richTextBox1);
                    openpath = op.PathOPen;
                    save     = false;
                    break;
                }
            }
            else
            {
                Open o = new Open();
                o.Set(richTextBox1);
                openpath = o.PathOPen;
                save     = false;
            }
        }
Exemplo n.º 3
0
Arquivo: Form1.cs Projeto: llxq/.net
        private void 新建7NToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (save == false)
            {
                DialogResult dr = MessageBox.Show("未保存文件,是否保存?", "提示", MessageBoxButtons.YesNo);
                switch (dr)
                {
                case DialogResult.Yes:
                    Baocun bc = new Baocun();
                    bc.Get(richTextBox1);
                    richTextBox1.Clear();
                    save = true;
                    break;

                case DialogResult.No:
                    richTextBox1.Clear();
                    save = false;
                    break;
                }
                save = false;
            }
            else
            {
                richTextBox1.Clear();
                save = false;
            }
        }
Exemplo n.º 4
0
Arquivo: Form1.cs Projeto: llxq/.net
 private void 另存ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (dk == false && save == false)
     {
         using (FileStream filewrite = new FileStream(openpath, FileMode.OpenOrCreate, FileAccess.Write))
         {
             byte[] buffer = Encoding.Default.GetBytes(richTextBox1.Text);
             filewrite.Write(buffer, 0, buffer.Length);
         }
         save = true;
         dk   = true;
     }
     else
     {
         if (save == false)
         {
             Baocun bc = new Baocun();
             bc.Get(richTextBox1);
             name = bc.Path;
             save = true;
         }
         if (save == true)
         {
             if (name == null)
             {
                 return;
             }
             using (FileStream filewrite = new FileStream(name, FileMode.OpenOrCreate, FileAccess.Write))
             {
                 byte[] buffer = Encoding.Default.GetBytes(richTextBox1.Text);
                 filewrite.Write(buffer, 0, buffer.Length);
             }
             save = true;
         }
     }
 }