设置字体和颜色
来源:互联网 发布:王者刷点卷的软件 编辑:程序博客网 时间:2024/04/27 17:49
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; } }}