Form1.cs
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;
namespace
_0057 {
-
public
partial
class
Form1 : Form {
-
public
Form1() {
-
InitializeComponent();
-
}
-
//кнопка Загрузить текст
-
private
void
button1_Click(
object
sender, EventArgs e) {
-
openFileDialog1.Filter =
"Text (*.txt) | *.txt"
;
-
if
(openFileDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.PlainText);
-
}
-
}
-
//кнопка Сохранить текст
-
private
void
button2_Click(
object
sender, EventArgs e) {
-
saveFileDialog1.Filter =
"Text (*.txt) | *.txt"
;
-
if
(saveFileDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
-
}
-
}
-
//кнопка Цвет
-
private
void
button3_Click(
object
sender, EventArgs e) {
-
if
(colorDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.Focus();
-
richTextBox1.SelectionColor = colorDialog1.Color;
-
}
-
}
-
//кнопка Шрифт
-
private
void
button4_Click(
object
sender, EventArgs e) {
-
if
(fontDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.Focus();
-
richTextBox1.SelectionFont = fontDialog1.Font;
-
}
-
}
-
//кнопка Очистить
-
private
void
button5_Click(
object
sender, EventArgs e) {
-
richTextBox1.Clear();
-
richTextBox1.Focus();
-
}
-
}
}
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;
namespace
_0057 {
-
public
partial
class
Form1 : Form {
-
public
Form1() {
-
InitializeComponent();
-
}
-
//кнопка Загрузить текст
-
private
void
button1_Click(
object
sender, EventArgs e) {
-
openFileDialog1.Filter =
"Text (*.txt) | *.txt"
;
-
if
(openFileDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.LoadFile(openFileDialog1.FileName, RichTextBoxStreamType.PlainText);
-
}
-
}
-
//кнопка Сохранить текст
-
private
void
button2_Click(
object
sender, EventArgs e) {
-
saveFileDialog1.Filter =
"Text (*.txt) | *.txt"
;
-
if
(saveFileDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.SaveFile(saveFileDialog1.FileName, RichTextBoxStreamType.PlainText);
-
}
-
}
-
//кнопка Цвет
-
private
void
button3_Click(
object
sender, EventArgs e) {
-
if
(colorDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.Focus();
-
richTextBox1.SelectionColor = colorDialog1.Color;
-
}
-
}
-
//кнопка Шрифт
-
private
void
button4_Click(
object
sender, EventArgs e) {
-
if
(fontDialog1.ShowDialog() == DialogResult.OK) {
-
richTextBox1.Focus();
-
richTextBox1.SelectionFont = fontDialog1.Font;
-
}
-
}
-
//кнопка Очистить
-
private
void
button5_Click(
object
sender, EventArgs e) {
-
richTextBox1.Clear();
-
richTextBox1.Focus();
-
}
-
}
}