Notepad dialog box

Source: Internet
Author: User

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.