<font size="4" color="#ff0000" ><strong><u>没找到上传压缩文件的按钮,只好把源代码上传到这里了.<img alt="" src="/Editor/FCKeditor/editor/images/smiley/msn/regular_smile.gif" ></u></strong></font>
没找到上传压缩文件的按钮,只好把源代码上传到这里了.
<strong><u><font size="4" color="#ff0000" >注释很详细哦</font></u></strong>
注释很详细哦
<font size="4" color="#ff0000" ><strong><u>Form1.cs </u></strong></font><strong><u><font size="4" color="#ff0000" >************************************************</font></u></strong>
Form1.cs ************************************************
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 txttest
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
#region 定义变量
public bool txtchange;
public bool save;
Search sea;
Change cha;
#endregion
#region 文件菜单
private void MnuNew_Click(object sender, EventArgs e)
{
NewFile();
}
private void MnuOpen_Click(object sender, EventArgs e)
{
OpenFile();
}
private void MnuSave_Click(object sender, EventArgs e)
{
save = true ;
SaveFile();
}
private void MnuSaveAs_Click(object sender, EventArgs e)
{
save = false ;
SaveFile();
}
private void MnuPageSetup_Click(object sender, EventArgs e)
{
pageSetupDialog1 = new PageSetupDialog();
pageSetupDialog1.Document = printDocument;
pageSetupDialog1.ShowDialog();
}
private void MnuPringPreview_Click(object sender, EventArgs e)
{
printPreviewDialog.ShowDialog();
}
private void MnuPrint_Click(object sender, EventArgs e)
{
printDocument.DocumentName = richTextBox1.Text;
printDialog.Document = printDocument;
if (printDialog.ShowDialog() == DialogResult.OK)
{
try
{
printDocument.Print();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void MnuExit_Click(object sender, EventArgs e)
{
DialogResult res;
res = MessageBox.Show("确定退出记事本?" , "退出提示" , MessageBoxButtons.OKCancel);
if (res == DialogResult.OK)
{
if (txtchange)
{
DialogResult re;
re = MessageBox.Show("内容已更改/n是否保存?" , "保存提示" , MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
if (re == DialogResult.Yes)
{
if (saveFileDialog.ShowDialog() == DialogResult.OK)
{
richTextBox1.SaveFile(saveFileDialog.FileName, RichTextBoxStreamType.PlainText);
Close();
}
else
return ;
}
else if (re == DialogResult.No)
{
Close();
}
else
{
return ;
}
}
else
Close();
}
else
return ;
}
private