namespace windowsformsapplication6{public partial class Form1:form {public Form1 () {in Itializecomponent (); private void Button1_Click (object sender, EventArgs e) {DialogResult Dr = Colordialog1.showdia Log (); if (dr = = DialogResult.OK) {this. BackColor = colorDialog1.Color; }} private void Button2_Click (object sender, EventArgs e) {DialogResult Dr = Folderbrowse Rdialog1.showdialog (); if (dr = = DialogResult.OK) {MessageBox.Show (Folderbrowserdialog1.selectedpath); } else {MessageBox.Show (folderbrowserdialog1.selectedpath); }} private void Button3_Click (object sender, EventArgs e) {fontdialog1.showdialog (); MessageBox.Show (FontDialog1.Font.Size.ToString ()); } private string Files; Private void Button4_Click (object sender, EventArgs e) {DialogResult Dr = Openfiledialog1.showdialog (); if (DialogResult.OK = = dr) {string filename = Openfiledialog1.filename; StreamReader sr = new StreamReader (filename); TextBox1.Text = Sr. ReadToEnd (); Sr. Close (); Files = filename; }} private void Button5_click (object sender, EventArgs e) {if (Files = = null) {savefiledialog1.filter = "text |*.txt|word|*.doc|excel|*.xls"; DialogResult dr = Savefiledialog1.showdialog (); if (dr = = DialogResult.OK) {string filename = Savefiledialog1.filename; StreamWriter SW = new StreamWriter (filename); Sw. Write (TextBox1.Text); Sw. Close (); }} else { StreamWriter SW = new StreamWriter (Files); Sw. Write (TextBox1.Text); Sw. Close (); }} private void Form1_Load (object sender, EventArgs e) {} private void Button6_click ( Object sender, EventArgs e) {this. Close (); private void Button7_click (object sender, EventArgs e) {pagesetupdialog1.document = Printdocum Ent1; Pagesetupdialog1.showdialog (); private void Button8_click (object sender, EventArgs e) {printdialog1.document = PrintDocument1 ; DialogResult dr = Printdialog1.showdialog (); if (dr = = DialogResult.OK) {printdocument1.print (); }} private void Printdocument1_printpage (object sender, System.Drawing.Printing.PrintPageEventArgs e) {System.Drawing.Font F = new System.Drawing.Font ("Arial", 12); E.graphics.drawstrING (textbox1.text,f,system.drawing.brushes.aqua,5,5); } private void Button9_click (object sender, EventArgs e) {textbox1.selectedtext = "ASD"; private void Button10_click (object sender, EventArgs e) {firstform.find f = new Firstform.fin D (This.textbox1.selectedtext,this); F.owner = this; F.show (); } }}
Notepad dialog box