Simple notepad, simple notepad camera

Source: Internet
Author: User

Simple notepad, simple notepad camera

 public partial class Form2 : Form    {        public Form2()        {            InitializeComponent();        }        private Form1 jishiben;        public Form2(Form1 f)        {            InitializeComponent();            jishiben = f;        }        public int index = -1;        private void cha_Click(object sender, EventArgs e)        {            string mubiao = txtchazhao.Text;            string yuanshuju = jishiben.txtjishiben.Text;             index = yuanshuju.IndexOf(mubiao,index+1);             if (index > -1)             {                 jishiben.txtjishiben.Select(index, mubiao.Length);                 jishiben.Focus();             }        }        private void tihuan_Click(object sender, EventArgs e)        {            jishiben.txtjishiben.Text = jishiben.txtjishiben.Text.Replace(txtchazhao.Text,txttihuan.Text);        }    }
Public partial class Form1: Form {public Form1 () {InitializeComponent ();} private void open OToolStripMenuItem_Click (object sender, EventArgs e) {openFileDialog1.Filter = "Text Document | *. txt | all files | *. * "; DialogResult isok = openFileDialog1.ShowDialog (); if (isok = DialogResult. OK) {string filePath = openFileDialog1.FileName; this.txt jishiben. text = File. readAllText (filePath, Encoding. default); this. text = new FileInfo (filePath ). name; // get file Name} private void create NToolStripMenuItem_Click (object sender, EventArgs e) {this.txt jishiben. text = "";} Save private void as AToolStripMenuItem_Click (object sender, EventArgs e) {saveFileDialog1.Filter = "Text Document | *. txt | all files | *. * "; DialogResult isok = saveFileDialog1.ShowDialog (); if (isok = DialogResult. OK) {string filename = saveFileDialog1.FileName; // StreamWriter sw = new StreamWriter (filename); // sw.Write(this.txt jishiben. text); // sw. close (); File.WriteAllText(filename,this.txt jishiben. text, Encoding. default) ;}} private void save SToolStripMenuItem_Click (object sender, EventArgs e) {string path = openFileDialog1.FileName; string n = this.txt jishiben. text; File. writeAllText (path, n, Encoding. default);} private void exit XToolStripMenuItem_Click (object sender, EventArgs e) {this. close ();} private void Print outputs (object sender, EventArgs e) {printDialog1.Document = printDocument1; DialogResult isok = printDialog1.ShowDialog (); if (isok = DialogResult. OK) {printDocument1.Print () ;}} private void print preview VToolStripMenuItem_Click (object sender, EventArgs e) {response (); printPreviewDialog1.Document = printDocument1;} private void printdocument#printpage (object sender, System. drawing. printing. printPageEventArgs e) {System. drawing. font f = new System. drawing. font ("", 19.8f); e.Graphics.DrawString(this.txt jishiben. text, f, System. drawing. brushes. blue, new Point (100,100);} private void search ToolStripMenuItem_Click (object sender, EventArgs e) {Form2 f = new Form2 (this); f. show ();}}

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: 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.