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 设置字体和颜色
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void 字体FToolStripMenuItem_Click(object sender, EventArgs e)
{
if (richTextBox1.SelectionFont == null) return;
else this.fontDialog1.Font = this.richTextBox1.SelectionFont;
DialogResult result = this.fontDialog1.ShowDialog();
if (result == DialogResult.OK)
this.richTextBox1.SelectionFont = this.fontDialog1.Font;
}
private void 颜色CToolStripMenuItem_Click(object sender, EventArgs e)
{
this.colorDialog1.Color = this.richTextBox1.SelectionColor;
DialogResult result = this.colorDialog1.ShowDialog();
if (result == DialogResult.OK)
this.richTextBox1.SelectionColor = this.colorDialog1.Color;
}
}
}
设置字体和颜色
最新推荐文章于 2020-01-08 16:42:16 发布