WinForm Small Program NotePad

Source: Internet
Author: User
Tags save file

Operating effect:

Code:

1 usingSystem;2 usingSystem.Collections.Generic;3 usingSystem.ComponentModel;4 usingSystem.Data;5 usingSystem.Drawing;6 usingSystem.Linq;7 usingSystem.Text;8 usingSystem.Threading.Tasks;9 usingSystem.Windows.Forms;Ten  One namespacefreenotes A { -      Public Partial classNotepad:form -     { the          PublicNotePad () -         { - InitializeComponent (); -         } +  -         /// <summary> +         ///Open File Event A         /// </summary> at         Private voidBtn_open_click (Objectsender, EventArgs e) -         { -OpenFileDialog of =NewOpenFileDialog (); -  -Of. DEFAULTEXT ="*.rtf"; -  inOf. Filter ="RTF file (*.rtf) |*.rtf| All Files (*. *) |*.*"; -  to             if(Of. ShowDialog () = = DialogResult.OK && of. Filename.length >0) +             { - Richtextbox1.loadfile (Of. FileName, richtextboxstreamtype.richtext); the             } *         } $ Panax Notoginseng         /// <summary> -         ///Save File Events the         /// </summary> +         Private voidBtn_save_click (Objectsender, EventArgs e) A         { theSaveFileDialog SA =NewSaveFileDialog (); +  -Sa. Title ="Save"; $  $Sa. FileName ="*.rtf"; -  -Sa. Filter ="RTF file (*.rtf) |*.rtf| All Files (*. *) |*.*"; the  -Sa. DEFAULTEXT ="*.rtf";Wuyi  the             if(SA. ShowDialog () = = DialogResult.OK && sa. Filename.length >0) -             { Wu Richtextbox1.savefile (SA. FileName, richtextboxstreamtype.richtext); -             } About         } $  -         /// <summary> -         ///Font Events -         /// </summary> A         Private voidBtn_font_click (Objectsender, EventArgs e) +         { theFontDialog FDA =NewFontDialog (); -  $Fda. Showcolor =true; the  the             if(FDA. ShowDialog ()! =DialogResult.Cancel) the             { theRichtextbox1.selectionfont =FDA. Font; -Richtextbox1.selectioncolor =FDA. Color; in             } the         } the  About         /// <summary> the         ///emptying text Events the         /// </summary> the         Private voidBtn_clear_click (Objectsender, EventArgs e) +         { - richtextbox1.clear (); the         }Bayi     } the}

WinForm Small Program NotePad

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.