统一归档20260319
This commit is contained in:
@@ -0,0 +1,58 @@
|
||||
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 _15_5
|
||||
{
|
||||
public partial class Form1 : Form
|
||||
{
|
||||
public Form1()
|
||||
{
|
||||
InitializeComponent();
|
||||
}
|
||||
|
||||
private void buttonOpen_Click(object sender, EventArgs e)
|
||||
{
|
||||
OpenFileDialog ofd = new OpenFileDialog();
|
||||
ofd.Filter = "文本文件(RTF)|*.rtf";
|
||||
ofd.FilterIndex = 2;
|
||||
ofd.RestoreDirectory = true;
|
||||
if (ofd.ShowDialog() == DialogResult.OK)
|
||||
richTextBox1.LoadFile(ofd.FileName);
|
||||
}
|
||||
|
||||
private void buttonSave_Click(object sender, EventArgs e)
|
||||
{
|
||||
SaveFileDialog sfd = new SaveFileDialog();
|
||||
sfd.Filter = "文本文件(RTF)|*.rtf";
|
||||
sfd.FilterIndex = 2;
|
||||
sfd.RestoreDirectory = true;
|
||||
if (sfd.ShowDialog() == DialogResult.OK)
|
||||
richTextBox1.SaveFile(sfd.FileName);
|
||||
}
|
||||
|
||||
private void buttonFonts_Click(object sender, EventArgs e)
|
||||
{
|
||||
FontDialog fontDialog = new FontDialog();
|
||||
fontDialog.ShowDialog();
|
||||
fontDialog.Font = richTextBox1.SelectionFont;
|
||||
fontDialog.Color = richTextBox1.SelectionColor;
|
||||
if (fontDialog.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
richTextBox1.SelectionFont = fontDialog.Font;
|
||||
richTextBox1.SelectionColor = fontDialog.Color;
|
||||
}
|
||||
}
|
||||
|
||||
private void buttonExit_Click(object sender, EventArgs e)
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user