richTextBoxFontClass
使用
private void button1_Click(object sender, EventArgs e)
{
RichTextBoxCtrl.richTextBoxFontClass r = new RichTextBoxCtrl.richTextBoxFontClass();
r.richTextBox = richTextBox1;
r.ToggleBold();
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Drawing; ////使用
//RichTextBoxCtrl.richTextBoxFontClass r = new RichTextBoxCtrl.richTextBoxFontClass();
//r.richTextBox = richTextBox1;
//r.ToggleBold(); namespace RichTextBoxCtrl
{
class richTextBoxFontClass
{ public richTextBoxFontClass()
{
richTextBox = new RichTextBox();
}
public RichTextBox richTextBox; //粗体
public void ToggleBold()
{
if (richTextBox.SelectionFont == null)
richTextBox.SelectionFont = richTextBox.Font; FontStyle style = richTextBox.SelectionFont.Style; if (richTextBox.SelectionFont.Bold) style &= ~FontStyle.Bold;//恢复正常
else
style |= FontStyle.Bold; richTextBox.SelectionFont = new Font(richTextBox.SelectionFont, style);
} //斜体
public void ToggleItalic()
{
if (richTextBox.SelectionFont == null)
richTextBox.SelectionFont = richTextBox.Font; FontStyle style = richTextBox.SelectionFont.Style; if (richTextBox.SelectionFont.Italic)
style &= ~FontStyle.Italic;//恢复正常
else
style |= FontStyle.Italic; richTextBox.SelectionFont = new Font(richTextBox.SelectionFont, style);
} //下划线
public void ToggleUnderLine()
{
if (richTextBox.SelectionFont == null)
richTextBox.SelectionFont = richTextBox.Font; FontStyle style = richTextBox.SelectionFont.Style; if (richTextBox.SelectionFont.Underline)
style &= ~FontStyle.Underline;//恢复正常
else
style |= FontStyle.Underline; richTextBox.SelectionFont = new Font(richTextBox.SelectionFont, style);
} //删除线
public void ToggleStrikeout()
{
if (richTextBox.SelectionFont == null)
richTextBox.SelectionFont = richTextBox.Font; FontStyle style = richTextBox.SelectionFont.Style; if (richTextBox.SelectionFont.Strikeout)
style &= ~FontStyle.Strikeout;//恢复正常
else
style |= FontStyle.Strikeout;
richTextBox.SelectionFont = new Font(richTextBox.SelectionFont, style);
}
}
}
richTextBoxFontClass的更多相关文章
随机推荐
- HBase安装inAction
在安装Hbase之前,需要有hadoop的运行环境,关于hadoop的安装过程,请查看我之前的blog:hadoop安装笔记:或者另一个博主的超详细文章http://weixiaolu.iteye.c ...
- C++笔记1: 单例模式。(一个简单的设计模式在C++中复杂出翔。。)
C++ 如果用指针new一个单例,内存不容易释放,所以Java和C#等语言中的单例模式在C++不适用... C++中,new申请的内存必须由delete释放,例如: Point p1; Point * ...
- 写一个TT模板自动生成spring.net下面的配置文件。
这个是目标. 然后想着就怎么开始 1.
- cocos2d-x Tests讲解 Particle System(粒子系统)
转载请注明出处: http://www.cnblogs.com/shangdahao/archive/2012/04/14/2447571.html 一.粒子系统简介: 粒子系统最早出现在80年代,主 ...
- 发布FireBird数据库所需要DLL文件
数据库版本:2.5.2 ib_util.dll; icudt30.dll; icuin30.dll icuuc30.dll
- DZ真是各种强大
近期对论坛做了大装修,非常享受这个过程. 真是着迷了,这个装修工程让我接连几天几乎到了废寝忘食的地步. 终于告一段落,又想起来折腾,因为对之前的文库系统感觉种种别扭. 没有空调,没有风扇,居然忙到夜里 ...
- 模拟键盘输入 : SendMessage, keybd_event, PostKeybdMessage
转自模拟键盘输入 : SendMessage, keybd_event, PostKeybdMessage 目的 最近项目要求在Windows CE下模拟键盘输入,上网搜索了一下,发现有3个API可以 ...
- [topcoder]KingdomReorganization
http://community.topcoder.com/stat?c=problem_statement&pm=11282&rd=14724 这道题是最小生成树,但怎么转化是关键. ...
- Altium Designer10 如何导出Gerber文件
版本:AD10.818 目的:Gerber文件导出备忘 http://blog.sina.com.cn/s/blog_9b9a51990100zyyv.html 目录: Step1:设置原点 Step ...
- Qt的事件模型(5种使用办法,通常重新实现event handler即可。只有定义控件才需要管理信号的发射)
Qt的事件模型 1.事件的概念 应用程序对象将系统消息接收为 Qt 事件.应用程序可以按照不同的粒度对事件加以监控.过滤并做出响应. 在 Qt 中,事件是指从 QEvent继承 的对象.Qt将事件发送 ...