المفكرة notepad بلغة #C


المفكرة  notepad بلغة #C


using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Data;

using System.Drawing;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

using System.Windows.Forms;

using System.IO;



namespace Notepade

{

    public partial class Form1 : Form

    {

        public Form1()

        {

            InitializeComponent();

        }



        private void openToolStripMenuItem_Click(object sender, EventArgs e)

        {

            OpenFileDialog opentext = new OpenFileDialog();

            opentext.Filter = "File|*.*;";

            if (opentext.ShowDialog() == DialogResult.OK)

            {

                if (File.Exists(opentext.FileName))

                {

                    richTextBox1.Lines = File.ReadAllLines(opentext.FileName);

                }

            }

        }



        private void saveCtrlSToolStripMenuItem_Click(object sender, EventArgs e)

        {

            SaveFileDialog saveone = new SaveFileDialog();

            saveone.Filter = "File|*.TXT";

            if (saveone.ShowDialog() == DialogResult.OK)

            {

                File.WriteAllText(saveone.FileName, richTextBox1.Text);

            }

        }



        private void newToolStripMenuItem_Click(object sender, EventArgs e)

        {

            SaveFileDialog saveone = new SaveFileDialog();

            saveone.Filter = "File|*.TXT";

            if (saveone.ShowDialog() == DialogResult.OK)

            {

                File.WriteAllText(saveone.FileName, richTextBox1.Text);

            }

            richTextBox1.Text = "";

        }



        private void exitToolStripMenuItem_Click(object sender, EventArgs e)

        {

            Application.Exit();

        }



        private void aboutNotBookToolStripMenuItem_Click(object sender, EventArgs e)

        {

            MessageBox.Show("THIS PROGRAME MADE BY p.x.programmer@gmail.com bulid completed project with database");

        }



        private void fontToolStripMenuItem_Click(object sender, EventArgs e)

        {

            if(fontDialog1.ShowDialog() == DialogResult.OK)

            {

                richTextBox1.SelectionFont = fontDialog1.Font;

            }

        }



        private void colorToolStripMenuItem_Click(object sender, EventArgs e)

        {

            if(colorDialog1.ShowDialog() == DialogResult.OK)

            {

                richTextBox1.SelectionColor = colorDialog1.Color;

            }

        }



        private void copyToolStripMenuItem_Click(object sender, EventArgs e)

        {

            richTextBox1.Copy();

        }



        private void cutCtrlToolStripMenuItem_Click(object sender, EventArgs e)

        {

            richTextBox1.Cut();

        }



        private void pasteCtrlPToolStripMenuItem_Click(object sender, EventArgs e)

        {

            richTextBox1.Paste();

        }



        private void copyToolStripMenuItem1_Click(object sender, EventArgs e)

        {

            richTextBox1.Copy();

        }



        private void pasteToolStripMenuItem_Click(object sender, EventArgs e)

        {

            richTextBox1.Paste();

        }



        private void cutToolStripMenuItem_Click(object sender, EventArgs e)

        {

            richTextBox1.Cut();

        }



        private void printToolStripMenuItem_Click(object sender, EventArgs e)

        {

            printDialog1.ShowDialog();

        }



        private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)

        {

            e.Graphics.DrawString(richTextBox1.Text, new Font("Tahome", 18), Brushes.Black, 10, 20);

        }

    }

}



تحميل المشروع https://cut-win.com/3SzgjTp



ليست هناك تعليقات:

يتم التشغيل بواسطة Blogger.