/form
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.IO ;
namespace 记事本
{
/// <summary>
/// Form1 的摘要说明。
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.MainMenu mainMenu1;
private System.Windows.Forms.MenuItem menuItem1;
private System.Windows.Forms.MenuItem menuItem2;
private System.Windows.Forms.MenuItem menuItem3;
private System.Windows.Forms.MenuItem menuItem4;
private System.Windows.Forms.MenuItem menuItem9;
private System.Windows.Forms.MenuItem menuItem12;
private System.Windows.Forms.MenuItem menuItem15;
private System.Windows.Forms.MenuItem menuItem20;
private System.Windows.Forms.MenuItem menuItem25;
private System.Windows.Forms.MenuItem menuItem31;
private System.Windows.Forms.MenuItem xinjian;
private System.Windows.Forms.MenuItem dakai;
private System.Windows.Forms.MenuItem baocun;
private System.Windows.Forms.MenuItem lbaocun;
private System.Windows.Forms.MenuItem ymsj;
private System.Windows.Forms.MenuItem dayin;
private System.Windows.Forms.MenuItem tuichu;
private System.Windows.Forms.MenuItem chexiao;
private System.Windows.Forms.MenuItem jianqie;
private System.Windows.Forms.MenuItem fuzhi;
private System.Windows.Forms.MenuItem niantie;
private System.Windows.Forms.MenuItem shanchu;
private System.Windows.Forms.MenuItem chazhao;
private System.Windows.Forms.MenuItem nextchz;
private System.Windows.Forms.MenuItem tihuan;
private System.Windows.Forms.MenuItem zhuandao;
private System.Windows.Forms.MenuItem quanxuan;
private System.Windows.Forms.MenuItem riqi;
private System.Windows.Forms.MenuItem zidonghuanh;
private System.Windows.Forms.MenuItem ziti;
private System.Windows.Forms.MenuItem bangzhuti;
private System.Windows.Forms.MenuItem about;
public System.Windows.Forms.TextBox text;
private System.Windows.Forms.SaveFileDialog saveFileDialog1;
private System.Windows.Forms.OpenFileDialog openFileDialog1;
private System.Windows.Forms.FontDialog fd;
private System.Windows.Forms.PrintDialog printDialog1;
private System.Drawing.Printing.PrintDocument printDocument1;
private string ywdz="";//打开文件的完整地址
private System.Windows.Forms.PageSetupDialog pageSetupDialog1;
private string[] lines;
private int linesPrinted;
private string ywen="";//打开文件的内容
private string wjm;//打开文件的文件名
private StringReader myReader;
public bool ycz=false;
public string gqwz;
chazhao find;
private System.Windows.Forms.MenuItem menuItem5;
private System.Windows.Forms.PrintPreviewDialog printPreviewDialog1;
Form2 fm2=new Form2 ();
private void baocun_Click(object sender, System.EventArgs e)
{
bcun();
}
private void xinjian_Click(object sender, System.EventArgs e)
{
DialogResult jg;
if(ywen!=this.text .Text )
{
jg=pd();
if(jg==DialogResult.Cancel )
{
return;
}
if(jg==DialogResult.Yes )
{
this.bcun ();
}
}
xjian();
}
void xjian()
{
this.text .Text ="";
this.ywen ="";
this.wjm ="新建文件";
this.Text =wjm+"-记事本";
}
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(Form1));
this.mainMenu1 = new System.Windows.Forms.MainMenu();
this.menuItem1 = new System.Windows.Forms.MenuItem();
this.xinjian = new System.Windows.Forms.MenuItem();
this.dakai = new System.Windows.Forms.MenuItem();
this.baocun = new System.Windows.Forms.MenuItem();
this.lbaocun = new System.Windows.Forms.MenuItem();
this.menuItem9 = new System.Windows.Forms.MenuItem();
this.ymsj = new System.Windows.Forms.MenuItem();
this.dayin = new System.Windows.Forms.MenuItem();
this.menuItem5 = new System.Windows.Forms.MenuItem();
this.menuItem12 = new System.Windows.Forms.MenuItem();
this.tuichu = new System.Windows.Forms.MenuItem();
this.menuItem2 = new System.Windows.Forms.MenuItem();
this.chexiao = new System.Windows.Forms.MenuItem();
this.menuItem15 = new System.Windows.Forms.MenuItem();
this.jianqie = new System.Windows.Forms.MenuItem();
this.fuzhi = new System.Windows.Forms.MenuItem();
this.niantie = new System.Windows.Forms.MenuItem();
this.shanchu = new System.Windows.Forms.MenuItem();
this.menuItem20 = new System.Windows.Forms.MenuItem();
this.chazhao = new System.Windows.Forms.MenuItem();
this.nextchz = new System.Windows.Forms.MenuItem();
this.tihuan = new System.Windows.Forms.MenuItem();
this.zhuandao = new System.Windows.Forms.MenuItem();
this.menuItem25 = new System.Windows.Forms.MenuItem();
this.quanxuan = new System.Windows.Forms.MenuItem();
this.riqi = new System.Windows.Forms.MenuItem();
this.menuItem3 = new System.Windows.Forms.MenuItem();
this.zidonghuanh = new System.Windows.Forms.MenuItem();
this.ziti = new System.Windows.Forms.MenuItem();
this.menuItem4 = new System.Windows.Forms.MenuItem();
this.bangzhuti = new System.Windows.Forms.MenuItem();
this.menuItem31 = new System.Windows.Forms.MenuItem();
this.about = new System.Windows.Forms.MenuItem();
this.text = new System.Windows.Forms.TextBox();
this.saveFileDialog1 = new System.Windows.Forms.SaveFileDialog();
this.openFileDialog1 = new System.Windows.Forms.OpenFileDialog();
this.printDialog1 = new System.Windows.Forms.PrintDialog();
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
this.pageSetupDialog1 = new System.Windows.Forms.PageSetupDialog();
this.printPreviewDialog1 = new System.Windows.Forms.PrintPreviewDialog();
this.SuspendLayout();
//
// mainMenu1
//
this.mainMenu1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.menuItem1,
this.menuItem2,
this.menuItem3,
this.menuItem4});
//
// menuItem1
//
this.menuItem1.Index = 0;
this.menuItem1.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.xinjian,
this.dakai,
this.baocun,
this.lbaocun,
this.menuItem9,
this.ymsj,
this.dayin,
this.menuItem5,
this.menuItem12,
this.tuichu});
this.menuItem1.Text = "文件(&F)";
//
// xinjian
//
this.xinjian.Index = 0;
this.xinjian.Shortcut = System.Windows.Forms.Shortcut.CtrlN;
this.xinjian.Text = "新建(&N)";
this.xinjian.Click += new System.EventHandler(this.xinjian_Click);
//
// dakai
//
this.dakai.Index = 1;
this.dakai.Shortcut = System.Windows.Forms.Shortcut.CtrlO;
this.dakai.Text = "打开(&O)...";
this.dakai.Click += new System.EventHandler(this.dakai_Click);
//
// baocun
//
this.baocun.Index = 2;
this.baocun.Shortcut = System.Windows.Forms.Shortcut.CtrlS;
this.baocun.Text = "保存(&S)";
this.baocun.Click += new System.EventHandler(this.baocun_Click);
//
// lbaocun
//
this.lbaocun.Index = 3;
this.lbaocun.Text = "另存为(&A)...";
this.lbaocun.Click += new System.EventHandler(this.lbaocun_Click);
//
// menuItem9
//
this.menuItem9.Index = 4;
this.menuItem9.Text = "-";
//
// ymsj
//
this.ymsj.Index = 5;
this.ymsj.Text = "页面设置(&U)...";
this.ymsj.Click += new System.EventHandler(this.ymsj_Click);
//
// dayin
//
this.dayin.Index = 6;
this.dayin.Shortcut = System.Windows.Forms.Shortcut.CtrlP;
this.dayin.Text = "打印(&P)...";
this.dayin.Click += new System.EventHandler(this.dayin_Click);
//
// menuItem5
//
this.menuItem5.Index = 7;
this.menuItem5.Text = "打印预览...";
this.menuItem5.Click += new System.EventHandler(this.menuItem5_Click);
//
// menuItem12
//
this.menuItem12.Index = 8;
this.menuItem12.Text = "-";
//
// tuichu
//
this.tuichu.Index = 9;
this.tuichu.Text = "退出(&X)";
this.tuichu.Click += new System.EventHandler(this.tuichu_Click);
//
// menuItem2
//
this.menuItem2.Index = 1;
this.menuItem2.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.chexiao,
this.menuItem15,
this.jianqie,
this.fuzhi,
this.niantie,
this.shanchu,
this.menuItem20,
this.chazhao,
this.nextchz,
this.tihuan,
this.zhuandao,
this.menuItem25,
this.quanxuan,
this.riqi});
this.menuItem2.Text = "编辑(&E)";
this.menuItem2.Popup += new System.EventHandler(this.menuItem2_Popup);
//
// chexiao
//
this.chexiao.Index = 0;
this.chexiao.Shortcut = System.Windows.Forms.Shortcut.CtrlZ;
this.chexiao.Text = "撤消(&U)";
this.chexiao.Click += new System.EventHandler(this.chexiao_Click);
//
// menuItem15
//
this.menuItem15.Index = 1;
this.menuItem15.Text = "-";
//
// jianqie
//
this.jianqie.Index = 2;
this.jianqie.Shortcut = System.Windows.Forms.Shortcut.CtrlX;
this.jianqie.Text = "剪切(&T)";
this.jianqie.Click += new System.EventHandler(this.jianqie_Click);
//
// fuzhi
//
this.fuzhi.Index = 3;
this.fuzhi.Shortcut = System.Windows.Forms.Shortcut.CtrlC;
this.fuzhi.Text = "复制(&C)";
this.fuzhi.Click += new System.EventHandler(this.fuzhi_Click);
//
// niantie
//
this.niantie.Index = 4;
this.niantie.Shortcut = System.Windows.Forms.Shortcut.CtrlV;
this.niantie.Text = "粘贴(&P)";
this.niantie.Click += new System.EventHandler(this.niantie_Click);
//
// shanchu
//
this.shanchu.Index = 5;
this.shanchu.Shortcut = System.Windows.Forms.Shortcut.Del;
this.shanchu.Text = "删除(&L)";
this.shanchu.Click += new System.EventHandler(this.shanchu_Click);
//
// menuItem20
//
this.menuItem20.Index = 6;
this.menuItem20.Text = "-";
//
// chazhao
//
this.chazhao.Enabled = false;
this.chazhao.Index = 7;
this.chazhao.Shortcut = System.Windows.Forms.Shortcut.CtrlF;
this.chazhao.Text = "查找(&F)...";
this.chazhao.Click += new System.EventHandler(this.chazhao_Click);
//
// nextchz
//
this.nextchz.Enabled = false;
this.nextchz.Index = 8;
this.nextchz.Shortcut = System.Windows.Forms.Shortcut.F3;
this.nextchz.Text = "查找下一个(&N)";
this.nextchz.Click += new System.EventHandler(this.nextchz_Click);
//
// tihuan
//
this.tihuan.Index = 9;
this.tihuan.Shortcut = System.Windows.Forms.Shortcut.CtrlH;
this.tihuan.Text = "替换(&R)...";
this.tihuan.Click += new System.EventHandler(this.tihuan_Click);
//
// zhuandao
//
this.zhuandao.Index = 10;
this.zhuandao.Shortcut = System.Windows.Forms.Shortcut.CtrlG;
this.zhuandao.Text = "转到(&G)...";
this.zhuandao.Click += new System.EventHandler(this.zhuandao_Click);
//
// menuItem25
//
this.menuItem25.Index = 11;
this.menuItem25.Text = "-";
//
// quanxuan
//
this.quanxuan.Index = 12;
this.quanxuan.Shortcut = System.Windows.Forms.Shortcut.CtrlA;
this.quanxuan.Text = "全选(&A)";
this.quanxuan.Click += new System.EventHandler(this.quanxuan_Click);
//
// riqi
//
this.riqi.Index = 13;
this.riqi.Shortcut = System.Windows.Forms.Shortcut.F5;
this.riqi.Text = "时间/日期(&D)";
this.riqi.Click += new System.EventHandler(this.riqi_Click);
//
// menuItem3
//
this.menuItem3.Index = 2;
this.menuItem3.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.zidonghuanh,
this.ziti});
this.menuItem3.Text = "格式(&O)";
//
// zidonghuanh
//
this.zidonghuanh.Checked = true;
this.zidonghuanh.Index = 0;
this.zidonghuanh.Text = "自动换行(&W)";
this.zidonghuanh.Click += new System.EventHandler(this.zidonghuanh_Click);
//
// ziti
//
this.ziti.Index = 1;
this.ziti.Text = "字体(&F)...";
this.ziti.Click += new System.EventHandler(this.ziti_Click);
//
// menuItem4
//
this.menuItem4.Index = 3;
this.menuItem4.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] {
this.bangzhuti,
this.menuItem31,
this.about});
this.menuItem4.Text = "帮助(&H)";
//
// bangzhuti
//
this.bangzhuti.Index = 0;
this.bangzhuti.Text = "帮助主题(&H)";
this.bangzhuti.Click += new System.EventHandler(this.bangzhuti_Click);
//
// menuItem31
//
this.menuItem31.Index = 1;
this.menuItem31.Text = "-";
//
// about
//
this.about.Index = 2;
this.about.Text = "关于记事本(&A)";
this.about.Click += new System.EventHandler(this.about_Click);
//
// text
//
this.text.Dock = System.Windows.Forms.DockStyle.Fill;
this.text.HideSelection = false;
this.text.Location = new System.Drawing.Point(0, 0);
this.text.Multiline = true;
this.text.Name = "text";
this.text.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.text.Size = new System.Drawing.Size(472, 273);
this.text.TabIndex = 0;
this.text.Text = "";
this.text.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.text_KeyPress);
this.text.TextChanged += new System.EventHandler(this.text_TextChanged);
this.text.MouseMove += new System.Windows.Forms.MouseEventHandler(this.text_MouseMove);
//
// printDocument1
//
this.printDocument1.BeginPrint += new System.Drawing.Printing.PrintEventHandler(this.printDocument1_BeginPrint);
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
//
// printPreviewDialog1
//
this.printPreviewDialog1.AutoScrollMargin = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.AutoScrollMinSize = new System.Drawing.Size(0, 0);
this.printPreviewDialog1.ClientSize = new System.Drawing.Size(400, 300);
this.printPreviewDialog1.Document = this.printDocument1;
this.printPreviewDialog1.Enabled = true;
this.printPreviewDialog1.Icon = ((System.Drawing.Icon)(resources.GetObject("printPreviewDialog1.Icon")));
this.printPreviewDialog1.Location = new System.Drawing.Point(147, 54);
this.printPreviewDialog1.MinimumSize = new System.Drawing.Size(375, 250);
this.printPreviewDialog1.Name = "printPreviewDialog1";
this.printPreviewDialog1.TransparencyKey = System.Drawing.Color.Empty;
this.printPreviewDialog1.Visible = false;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(472, 273);
this.Controls.Add(this.text);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Menu = this.mainMenu1;
this.Name = "Form1";
this.Text = "Form1";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form1_Closing);
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// 应用程序的主入口点。
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void chazhao_Click(object sender, System.EventArgs e)
{
//findl.chazhao find=new findl.chazhao (this.text .Text ,this.text .SelectedText );
//find.Owner =this;
//find.Show ();
//ycz=true;
find.CorT =true;
find.Show();
}
private void jianqie_Click(object sender, System.EventArgs e)
{
this.gqwz =this.text .Text ;
this.text .Cut ();
}
private void fuzhi_Click(object sender, System.EventArgs e)
{
this.gqwz =this.text .Text ;
this.text .Copy ();
}
private void niantie_Click(object sender, System.EventArgs e)
{
this.gqwz =this.text .Text ;
this.text .Paste ();
}
private void text_MouseMove(object sender, System.Windows.Forms.MouseEventArgs e)
{
textpd();
}
private void text_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
textpd();
}
private void textpd()
{
if(this.text .SelectedText =="")
{
this.jianqie .Enabled =false;
this.fuzhi .Enabled =false;
this.shanchu .Enabled =false;
}
else
{
this.jianqie .Enabled =true;
this.fuzhi .Enabled =true;
this.shanchu .Enabled =true;
}
}
private void lcw()
{
this.saveFileDialog1 .Filter ="文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
this.saveFileDialog1 .AddExtension =true;
string filename;
System.IO.StreamWriter swriter;
DialogResult answer=this.saveFileDialog1 .ShowDialog ();
if (answer==DialogResult.OK )
{
try
{
filename=this.saveFileDialog1 .FileName ;
swriter=new System.IO.StreamWriter(filename,false,System.Text.Encoding .Default );
}
catch(Exception x)
{
MessageBox.Show("文件打开失败:"+x.Message );
return;
}
swriter.Write (this.text .Text );
this.ywdz =filename;
this.gqwz =this.ywen =this.text .Text ;
this.wjm =System.IO.Path .GetFileNameWithoutExtension (filename);
this.Text =wjm+"-记事本";
swriter.Close ();
}
}
private void lbaocun_Click(object sender, System.EventArgs e)
{
lcw();
}
private void dakai_Click(object sender, System.EventArgs e)
{
DialogResult jg;
if(ywen!=this.text .Text )
{
jg=pd();
if(jg==DialogResult.Cancel )
{
return;
}
if(jg==DialogResult.Yes )
{
this.bcun ();
}
}
open();
}
private void open()
{
this.openFileDialog1 .InitialDirectory ="e://";
this.openFileDialog1 .Filter ="文本文件(*.txt)|*.txt|所有文件(*.*)|*.*";
string filename;
System.IO.StreamReader sread;
DialogResult answer=this.openFileDialog1 .ShowDialog ();
if (answer==DialogResult.OK )
{
try
{
filename=this.openFileDialog1 .FileName ;
sread=new System.IO.StreamReader(filename,System.Text .Encoding.Default );
}
catch(Exception x)
{
MessageBox.Show("文件打开失败:"+x.Message );
return;
}
this.text .Text=sread.ReadToEnd();
this.ywdz =filename;
this.wjm =System.IO.Path .GetFileNameWithoutExtension (ywdz);
this.Text =wjm+"-记事本";
this.gqwz =this.ywen =this.text .Text ;
sread.Close ();
}
}
private void zidonghuanh_Click(object sender, System.EventArgs e)
{
if(this.zidonghuanh.Checked==true)
{
this.text.WordWrap=false;
this.zidonghuanh.Checked=false;
}
else
{
this.zidonghuanh.Checked=true;
this.text.WordWrap=true;
}
}
private void ziti_Click(object sender, System.EventArgs e)
{
DialogResult answer;
fd=new FontDialog();
fd.ShowApply=true;
fd.Apply+=new EventHandler(yingyong);
fd.ShowColor=true;
fd.Font =this.text .Font ;
fd.Color=this.text.ForeColor;
answer=fd.ShowDialog();
if(answer==DialogResult.OK)
{
this.text.Font=fd.Font;
this.text.ForeColor=fd.Color;
}
}
private void yingyong(object sender,System.EventArgs e)
{
this.text.Font=fd.Font;
this.text.ForeColor=fd.Color;
}
private void tuichu_Click(object sender, System.EventArgs e)
{
Application.Exit ();
}
private void quanxuan_Click(object sender, System.EventArgs e)
{
this.text .SelectAll ();
}
private void dayin_Click(object sender, System.EventArgs e)
{
this.printDocument1.DocumentName ="打印文档";
printDialog1=new PrintDialog();
this.printDialog1.Document =this.printDocument1 ;
this.printDialog1.AllowSelection =true;
this.printDialog1.ShowNetwork =true;
this.printDialog1.AllowSomePages=true;
string strText = text.Text ;
myReader = new StringReader ( strText ) ;
if ( printDialog1.ShowDialog () == DialogResult.OK )
{
printDocument1.Print ( ) ;
}
}
private void ymsj_Click(object sender, System.EventArgs e)
{
try
{
this.pageSetupDialog1.Document=this.printDocument1;
this.pageSetupDialog1.ShowDialog();
}
catch
{
MessageBox.Show ("没有打印机");
}
}
private void printDocument1_BeginPrint(object sender, System.Drawing.Printing.PrintEventArgs e)
{
string [] lines=this.text.Lines;
this.lines=this.text.Lines;
this.linesPrinted =0;
}
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
int x=e.MarginBounds.Left ;
int y=e.MarginBounds .Top ;
while (linesPrinted<lines.Length )
{
e.Graphics .DrawString (lines[linesPrinted],new Font ("宋体",10),Brushes.Black ,x,y);
linesPrinted++;
y=y+15;
if (y>e.MarginBounds .Bottom)
{
e.HasMorePages =true;
return;
}
}
this.linesPrinted=0;
e.HasMorePages =false;
}
private void shanchu_Click(object sender, System.EventArgs e)
{
this.gqwz =this.text .Text ;
this.text .SelectedText ="";
}
private void bangzhuti_Click(object sender, System.EventArgs e)
{
Help.ShowHelp(this,"notepad.chm");
}
private void Form1_Load(object sender, System.EventArgs e)
{
this.wjm ="新建文件";
this.Text =wjm+"-记事本";
find=new chazhao ( );
find.Owner=this;
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text ))
{
this.niantie .Enabled =true;
}
else
{
this.niantie .Enabled =false;
}
}
DialogResult pd( )
{
return MessageBox.Show (wjm+"的文字已经改变。/r/n想保存文件吗?","记事本",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Warning);
}
void bcun()
{
if(this.ywdz =="")
{
this.lcw ();
}
else
{
System.IO.StreamWriter sr;
sr=new System .IO .StreamWriter (ywdz,false,System.Text .Encoding .Default );
sr.Write (this.text .Text );
this.ywen =this.text .Text ;
sr.Close ();
}
}
private void Form1_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
DialogResult jg;
if(ywen!=this.text .Text )
{
jg=pd();
if(jg==DialogResult.Cancel )
{
e.Cancel =true;
return;
}
if(jg==DialogResult.Yes )
{
this.bcun ();
}
}
}
private void text_TextChanged(object sender, System.EventArgs e)
{
if(this.text .Text =="")
{
this.chazhao .Enabled =false;
this.nextchz .Enabled =false;
}
else
{
this.chazhao .Enabled=true;
this.nextchz .Enabled =true;
}
find.Wenben =this.text .Text ;
}
private void nextchz_Click(object sender, System.EventArgs e)
{
if(this.ycz )
find.findtext ();
else
{
find.CorT =true;
find.Show ();
}
}
private void zhuandao_Click(object sender, System.EventArgs e)
{
fm2.Owner =this;
fm2.Top =this.Top +30;
fm2.Left =this.Left +5;
fm2.Show ();
}
private void tihuan_Click(object sender, System.EventArgs e)
{
find.CorT =false;
this.text .SelectionStart =0;
find.Show ();
}
private void about_Click(object sender, System.EventArgs e)
{
about ab=new about ();
ab.ShowDialog ();
}
private void menuItem5_Click(object sender, System.EventArgs e)
{
try
{
this.printPreviewDialog1 .Show ();
}
catch
{
MessageBox.Show ("没有打印机");
}
}
private void riqi_Click(object sender, System.EventArgs e)
{
this.text .SelectedText =System.DateTime .Now.ToString ();
}
private void menuItem2_Popup(object sender, System.EventArgs e)
{
IDataObject iData = Clipboard.GetDataObject();
if (iData.GetDataPresent(DataFormats.Text ))
{
this.niantie .Enabled =true;
}
else
{
this.niantie .Enabled =false;
}
}
private void chexiao_Click(object sender, System.EventArgs e)
{
this.text .Text =this.gqwz ;
this.text .Undo ();
}
}
}
//**********************************************************************************************************************
//查找对话框
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 记事本
{
/// <summary>
/// UserControl1 的摘要说明。
/// </summary>
public class chazhao : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button next;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.GroupBox groupBox1;
private System.Windows.Forms.RadioButton radioButton1;
private System.Windows.Forms.RadioButton radioButton2;
private System.Windows.Forms.CheckBox checkBox1;
private System.Windows.Forms.HelpProvider helpProvider1;
private string wenben;
string findnr;
Form1 fm1;
bool qfdxx=true;
bool updown=true;
int selectstar=0;
int selectlength=0;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.Button button3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox textBox2;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public int Selectstar
{
get
{
return this.selectstar ;
}
set
{
this.selectstar =value;
}
}
public int Selectlenght
{
get
{
return this.selectlength ;
}
set
{
this.selectlength =value;
}
}
public string Wenben
{
set
{
this.wenben =value;
}
}
public bool CorT
{
set
{
if(value)
{
this.button2 .Visible =false;
this.button3 .Visible =false;
this.Height =120;
this.button1 .Location =new Point (272,42);
this.checkBox1 .Location =new Point (8,50);
this.groupBox1 .Visible =true;
this.label2 .Visible =false;
this.textBox2 .Visible =false;
}
else
{
this.button2 .Visible =true;
this.button3 .Visible =true;
this.Height =180;
this.button1 .Location =new Point (272,118);
this.checkBox1 .Location =new Point (8,112);
this.groupBox1 .Visible =false;
this.label1 .Visible =true;
this.label2 .Visible =true;
this.textBox2 .Visible =true;
}
}
}
public chazhao()
{
// 该调用是 Windows.Forms 窗体设计器所必需的。
InitializeComponent();
// TODO: 在 InitComponent 调用后添加任何初始化
}
public chazhao(string tex,string xz):this()
{
this.wenben =tex;
this.findnr =this.textBox1 .Text =xz;
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if( components != null )
components.Dispose();
}
base.Dispose( disposing );
}
#region 组件设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器
/// 修改此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.label1 = new System.Windows.Forms.Label();
this.textBox1 = new System.Windows.Forms.TextBox();
this.next = new System.Windows.Forms.Button();
this.button1 = new System.Windows.Forms.Button();
this.groupBox1 = new System.Windows.Forms.GroupBox();
this.radioButton1 = new System.Windows.Forms.RadioButton();
this.radioButton2 = new System.Windows.Forms.RadioButton();
this.checkBox1 = new System.Windows.Forms.CheckBox();
this.helpProvider1 = new System.Windows.Forms.HelpProvider();
this.button2 = new System.Windows.Forms.Button();
this.button3 = new System.Windows.Forms.Button();
this.label2 = new System.Windows.Forms.Label();
this.textBox2 = new System.Windows.Forms.TextBox();
this.groupBox1.SuspendLayout();
this.SuspendLayout();
//
// label1
//
this.helpProvider1.SetHelpString(this.label1, "在此处键入要查找的文字.");
this.label1.Location = new System.Drawing.Point(8, 8);
this.label1.Name = "label1";
this.helpProvider1.SetShowHelp(this.label1, true);
this.label1.Size = new System.Drawing.Size(88, 16);
this.label1.TabIndex = 0;
this.label1.Text = "查找内容:(&N)";
//
// textBox1
//
this.helpProvider1.SetHelpString(this.textBox1, "在此处键入要查找的文字.");
this.textBox1.Location = new System.Drawing.Point(97, 4);
this.textBox1.Name = "textBox1";
this.helpProvider1.SetShowHelp(this.textBox1, true);
this.textBox1.Size = new System.Drawing.Size(167, 21);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "";
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// next
//
this.next.Enabled = false;
this.helpProvider1.SetHelpString(this.next, "查找在“查找内容”中指定文字的下一个实例。");
this.next.Location = new System.Drawing.Point(272, 8);
this.next.Name = "next";
this.helpProvider1.SetShowHelp(this.next, true);
this.next.Size = new System.Drawing.Size(96, 24);
this.next.TabIndex = 2;
this.next.Text = "查找下一个(&F)";
this.next.Click += new System.EventHandler(this.next_Click);
//
// button1
//
this.helpProvider1.SetHelpString(this.button1, "关闭该对话框,但不保存任何更改.");
this.button1.Location = new System.Drawing.Point(272, 48);
this.button1.Name = "button1";
this.helpProvider1.SetShowHelp(this.button1, true);
this.button1.Size = new System.Drawing.Size(96, 24);
this.button1.TabIndex = 2;
this.button1.Text = "取消";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// groupBox1
//
this.groupBox1.Controls.Add(this.radioButton1);
this.groupBox1.Controls.Add(this.radioButton2);
this.helpProvider1.SetHelpString(this.groupBox1, "指定从文档中插入点开始搜索的方向,单击/"向上/"将从插入点向上搜索.单击/"向下/"将从插入点向下搜索.");
this.groupBox1.Location = new System.Drawing.Point(104, 32);
this.groupBox1.Name = "groupBox1";
this.helpProvider1.SetShowHelp(this.groupBox1, true);
this.groupBox1.Size = new System.Drawing.Size(160, 48);
this.groupBox1.TabIndex = 3;
this.groupBox1.TabStop = false;
this.groupBox1.Text = "方向";
//
// radioButton1
//
this.radioButton1.Location = new System.Drawing.Point(8, 24);
this.radioButton1.Name = "radioButton1";
this.radioButton1.Size = new System.Drawing.Size(72, 16);
this.radioButton1.TabIndex = 0;
this.radioButton1.Text = "向上(&U)";
//
// radioButton2
//
this.radioButton2.Checked = true;
this.radioButton2.Location = new System.Drawing.Point(80, 24);
this.radioButton2.Name = "radioButton2";
this.radioButton2.Size = new System.Drawing.Size(72, 16);
this.radioButton2.TabIndex = 0;
this.radioButton2.TabStop = true;
this.radioButton2.Text = "向下(&D)";
this.radioButton2.CheckedChanged += new System.EventHandler(this.radioButton2_CheckedChanged);
//
// checkBox1
//
this.checkBox1.Checked = true;
this.checkBox1.CheckState = System.Windows.Forms.CheckState.Checked;
this.helpProvider1.SetHelpString(this.checkBox1, "只查找与/"查找内容/"中指定的大小写字符一致的文本");
this.checkBox1.Location = new System.Drawing.Point(8, 112);
this.checkBox1.Name = "checkBox1";
this.helpProvider1.SetShowHelp(this.checkBox1, true);
this.checkBox1.Size = new System.Drawing.Size(96, 24);
this.checkBox1.TabIndex = 4;
this.checkBox1.Text = "区分大小写";
this.checkBox1.CheckedChanged += new System.EventHandler(this.checkBox1_CheckedChanged);
//
// button2
//
this.button2.Enabled = false;
this.helpProvider1.SetHelpString(this.button2, "关闭该对话框,但不保存任何更改.");
this.button2.Location = new System.Drawing.Point(272, 41);
this.button2.Name = "button2";
this.helpProvider1.SetShowHelp(this.button2, true);
this.button2.Size = new System.Drawing.Size(96, 24);
this.button2.TabIndex = 5;
this.button2.Text = "替换(&R)";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// button3
//
this.helpProvider1.SetHelpString(this.button3, "关闭该对话框,但不保存任何更改.");
this.button3.Location = new System.Drawing.Point(272, 83);
this.button3.Name = "button3";
this.helpProvider1.SetShowHelp(this.button3, true);
this.button3.Size = new System.Drawing.Size(96, 24);
this.button3.TabIndex = 6;
this.button3.Text = "全部替换(&A)";
this.button3.Click += new System.EventHandler(this.button3_Click);
//
// label2
//
this.helpProvider1.SetHelpString(this.label2, "在此处键入要查找的文字.");
this.label2.Location = new System.Drawing.Point(8, 40);
this.label2.Name = "label2";
this.helpProvider1.SetShowHelp(this.label2, true);
this.label2.Size = new System.Drawing.Size(88, 16);
this.label2.TabIndex = 7;
this.label2.Text = "替换为:(&P)";
//
// textBox2
//
this.helpProvider1.SetHelpString(this.textBox2, "在此处键入要查找的文字.");
this.textBox2.Location = new System.Drawing.Point(97, 40);
this.textBox2.Name = "textBox2";
this.helpProvider1.SetShowHelp(this.textBox2, true);
this.textBox2.Size = new System.Drawing.Size(167, 21);
this.textBox2.TabIndex = 9;
this.textBox2.Text = "";
this.textBox2.TextChanged += new System.EventHandler(this.textBox2_TextChanged);
//
// chazhao
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(376, 146);
this.Controls.Add(this.textBox2);
this.Controls.Add(this.label2);
this.Controls.Add(this.button3);
this.Controls.Add(this.button2);
this.Controls.Add(this.checkBox1);
this.Controls.Add(this.groupBox1);
this.Controls.Add(this.next);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.label1);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "chazhao";
this.ShowInTaskbar = false;
this.Closing += new System.ComponentModel.CancelEventHandler(this.chazhao_Closing);
this.Load += new System.EventHandler(this.chazhao_Load);
this.groupBox1.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private void chazhao_Load(object sender, System.EventArgs e)
{
this.wenben =((Form1)this.Owner ).text .Text ;
this.TopLevel =true;
fm1=(Form1)this.Owner ;
//this.TopMost =true;
//this.FormBorderStyle =System.Windows .Forms .FormBorderStyle.FixedDialog ;
}
private void button1_Click(object sender, System.EventArgs e)
{
this.Hide ();
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
if(this.textBox1 .Text !="")
this.next .Enabled =true;
else
this.next .Enabled =false;
this.findnr =this.textBox1 .Text ;
this.findnr =this.textBox1 .Text ;
}
private void next_Click(object sender, System.EventArgs e)
{
findtext();
}
public void findtext()
{
fm1.ycz =true;
this.selectstar =fm1.text .SelectionStart +fm1.text.SelectedText.Length ;
if( this.qfdxx!=true)
{
this.wenben =this.wenben .ToLower ();
this.findnr =findnr.ToLower ();
}
if(this.updown )
{
if((this.selectstar=wenben.IndexOf (findnr,fm1.text.SelectionStart +fm1.text .SelectedText .Length ))==-1)
{
MessageBox.Show (findnr+"没有找到!");
this.selectstar=0;
}
else
{
fm1.text .SelectionStart =this.selectstar ;
fm1.text .SelectionLength =findnr.Length ;
}
}
else
{
if((this.selectstar=wenben.LastIndexOf (findnr,fm1.text.SelectionStart ))==-1)
{
MessageBox.Show (findnr+"没有找到!");
this.selectstar=0;
}
else
{
fm1.text .SelectionStart =this.selectstar ;
fm1.text .SelectionLength =findnr.Length ;
}
}
}
private void checkBox1_CheckedChanged(object sender, System.EventArgs e)
{
this.qfdxx =this.checkBox1 .Checked ;
}
private void radioButton2_CheckedChanged(object sender, System.EventArgs e)
{
this.updown =this.radioButton2 .Checked ;
}
private void chazhao_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel =true;
this.Hide ();
}
private void button3_Click(object sender, System.EventArgs e)
{
fm1.gqwz =fm1.text .Text ;
if(this.qfdxx )
fm1.text.Text =fm1.text .Text .Replace (this.textBox1 .Text ,this.textBox2 .Text );
else
{
int wz=0;
while((wz=fm1.text .Text .ToLower ().IndexOf (this.textBox1 .Text .ToLower (),wz))!=-1)
{
fm1.text.SelectionStart =wz;
fm1.text.SelectionLength =this.textBox1 .Text .Length ;
fm1.text .SelectedText =this.textBox2 .Text ;
}
}
}
private void button2_Click(object sender, System.EventArgs e)
{
fm1.gqwz =fm1.text .Text ;
this.updown =true;
if(fm1.text .SelectedText ==this.textBox1 .Text )
{
fm1.text .SelectedText =this.textBox2.Text ;
this.wenben =fm1.text .Text ;
}
this.findtext ();
}
private void textBox2_TextChanged(object sender, System.EventArgs e)
{
if(this.textBox2 .Text =="")
this.button2 .Enabled =false;
else
this.button2 .Enabled =true;
}
}
}
//*****************************************************************************************************************
//关于对话框
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Text;
using System.Runtime.InteropServices;
namespace 记事本
{
/// <summary>
/// about 的摘要说明。
/// </summary>
public class about : System.Windows.Forms.Form
{
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label nc;
public System.Windows.Forms.PictureBox pictureBox1;
private System.Windows.Forms.Label label3;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public about()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(about));
this.label1 = new System.Windows.Forms.Label();
this.label2 = new System.Windows.Forms.Label();
this.nc = new System.Windows.Forms.Label();
this.pictureBox1 = new System.Windows.Forms.PictureBox();
this.label3 = new System.Windows.Forms.Label();
this.SuspendLayout();
//
// label1
//
this.label1.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D;
this.label1.Location = new System.Drawing.Point(48, 240);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(360, 2);
this.label1.TabIndex = 0;
//
// label2
//
this.label2.Location = new System.Drawing.Point(56, 248);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(160, 48);
this.label2.TabIndex = 1;
this.label2.Text = "Windows 可用物理内存:";
//
// nc
//
this.nc.Location = new System.Drawing.Point(264, 248);
this.nc.Name = "nc";
this.nc.Size = new System.Drawing.Size(136, 32);
this.nc.TabIndex = 2;
//
// pictureBox1
//
this.pictureBox1.Image = ((System.Drawing.Image)(resources.GetObject("pictureBox1.Image")));
this.pictureBox1.Location = new System.Drawing.Point(0, 0);
this.pictureBox1.Name = "pictureBox1";
this.pictureBox1.Size = new System.Drawing.Size(432, 200);
this.pictureBox1.TabIndex = 3;
this.pictureBox1.TabStop = false;
//
// label3
//
this.label3.Location = new System.Drawing.Point(16, 216);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(400, 24);
this.label3.TabIndex = 4;
this.label3.Text = "组长:郑志强 组员:丛宝 杨晓明 王智 商震 吴顺杰 黄东";
//
// about
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(426, 303);
this.Controls.Add(this.label3);
this.Controls.Add(this.pictureBox1);
this.Controls.Add(this.nc);
this.Controls.Add(this.label2);
this.Controls.Add(this.label1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "about";
this.ShowInTaskbar = false;
this.Text = "关于记事本";
this.Load += new System.EventHandler(this.about_Load);
this.ResumeLayout(false);
}
#endregion
private void about_Load(object sender, System.EventArgs e)
{
Class1 class1 = new Class1();
this.nc .Text =(class1.GetMemoryStatus()/1000).ToString()+","+(class1.GetMemoryStatus()%1000).ToString()+"KB";
}
}
class Class1
{
[StructLayout(LayoutKind.Sequential)]
public struct MEMORY_INFO
{
public uint dwLength;
public uint dwMemoryLoad;
public uint dwTotalPhys;
public uint dwAvailPhys;
public uint dwTotalPageFile;
public uint dwAvailPageFile;
public uint dwTotalVirtual;
public uint dwAvailVirtual;
}
[DllImport("kernel32")]
public static extern void GlobalMemoryStatus(ref MEMORY_INFO meminfo);
public long GetMemoryStatus()
{
MEMORY_INFO MemInfo;
MemInfo = new MEMORY_INFO();
GlobalMemoryStatus(ref MemInfo);
long totalMb = Convert.ToInt64( MemInfo.dwTotalPhys.ToString())/1024;
long avaliableMb = Convert.ToInt64( MemInfo.dwAvailPhys.ToString())/1024;
return totalMb ;
}
}
}
//*******************************************************************************************************************
//转到对话框
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
namespace 记事本
{
/// <summary>
/// Form2 的摘要说明。
/// </summary>
public class Form2 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.TextBox textBox1;
/// <summary>
/// 必需的设计器变量。
/// </summary>
private System.ComponentModel.Container components = null;
public Form2()
{
//
// Windows 窗体设计器支持所必需的
//
InitializeComponent();
//
// TODO: 在 InitializeComponent 调用后添加任何构造函数代码
//
}
/// <summary>
/// 清理所有正在使用的资源。
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows 窗体设计器生成的代码
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.button2 = new System.Windows.Forms.Button();
this.textBox1 = new System.Windows.Forms.TextBox();
this.SuspendLayout();
//
// button1
//
this.button1.Location = new System.Drawing.Point(96, 8);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(80, 32);
this.button1.TabIndex = 0;
this.button1.Text = "确定";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// button2
//
this.button2.Location = new System.Drawing.Point(96, 48);
this.button2.Name = "button2";
this.button2.Size = new System.Drawing.Size(80, 32);
this.button2.TabIndex = 1;
this.button2.Text = "取消";
this.button2.Click += new System.EventHandler(this.button2_Click);
//
// textBox1
//
this.textBox1.Location = new System.Drawing.Point(24, 24);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(40, 21);
this.textBox1.TabIndex = 2;
this.textBox1.Text = "";
this.textBox1.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBox1_KeyPress);
this.textBox1.TextChanged += new System.EventHandler(this.textBox1_TextChanged);
//
// Form2
//
this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.ClientSize = new System.Drawing.Size(176, 85);
this.Controls.Add(this.textBox1);
this.Controls.Add(this.button2);
this.Controls.Add(this.button1);
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
this.HelpButton = true;
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form2";
this.Text = "转到下列行";
this.Closing += new System.ComponentModel.CancelEventHandler(this.Form2_Closing);
this.Load += new System.EventHandler(this.Form2_Load);
this.ResumeLayout(false);
}
#endregion
private void button1_Click(object sender, System.EventArgs e)
{
Form1 fm1=(Form1)this.Owner ;
//if(int.Parse (this.textBox1 .Text) >0&&int.Parse (this.textBox1 .Text) <9)
//{
if(int.Parse (this.textBox1 .Text)-1>fm1.text.Lines .Length )
MessageBox.Show ("行数超过范围","记事本-跳行");
else
{
int wz=0;
for(int i=0;i<int.Parse (this.textBox1 .Text )-1;i++)
{
wz=fm1.text.Text .IndexOf ("/n",wz)+1;
}
fm1.text .SelectionStart =wz;
}
//}
//else MessageBox.Show ("行数超过范围","记事本-跳行");
this.Hide ();
}
private void Form2_Load(object sender, System.EventArgs e)
{
this.textBox1 .Text ="1";
}
private void Form2_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel =true;
this.Hide();
}
private void textBox1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e)
{
if(e.KeyChar >'0'&&e.KeyChar <'9'||e.KeyChar ==8)
{}
else
e.Handled =true;
}
private void textBox1_TextChanged(object sender, System.EventArgs e)
{
}
private void button2_Click(object sender, System.EventArgs e)
{
this.Hide ();
}
}
}