29,088 views 153 on YTPak
93 16

Published on 12 Aug 2013 | over 3 years ago

This is the simple notepad program in c# windows form application
open, save and font code are below

/*open*/
OpenFileDialog op = new OpenFileDialog();
if(op.ShowDialog()==DialogResult.OK)
richTextBox1.LoadFile(op.FileName,RichTextBoxStreamType.PlainText);
this.Text=op.FileName;

/*save*/
SaveFileDialog sv = new SaveFileDialog();
sv.Filter = "Text Documents(*.txt)|*.txt|All Files(*.*)|*.*";
if (sv.ShowDialog() == DialogResult.OK)
richTextBox1.SaveFile(sv.FileName, RichTextBoxStreamType.PlainText);
this.Text = sv.FileName;

/*font */
FontDialog fd = new FontDialog();
fd.Font = richTextBox1.SelectionFont;
if (fd.ShowDialog() == DialogResult.OK)
{
richTextBox1.SelectionFont = fd.Font;
}

/*backcolor*/
ColorDialog cr = new ColorDialog();
if (cr.ShowDialog() == DialogResult.OK)
{
richTextBox1.BackColor = cr.Color;
}

Loading related videos...