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;//恢复正常elsestyle |= 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;//恢复正常elsestyle |= 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;//恢复正常elsestyle |= 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;//恢复正常elsestyle |= FontStyle.Strikeout;richTextBox.SelectionFont = new Font(richTextBox.SelectionFont, style);}}
}

 

转载于:https://www.cnblogs.com/xe2011/p/3446119.html

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/273926.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

我感觉我恰似一个呆逼

TicTacToe V2.0。 非要用1-9来输入的结果就是使用二维数组这件事的意义变得非常难找。 留个遗体,我要改回坐标输入了。 1 public class Game {2 String chessBoard;3 String[][] pieces new String[3][3];4 5 /** 初始化棋盘样式和棋子数组。*/6 …

辅助工具栏目

1、推荐一款录像软件: 《EVCapture》 2、图像处理软件:打马赛克,添加水印,《快剪辑》软件

Android启动initlogo.rle制作

步骤如下&#xff1a; rgb2565为out/host/linux-x86/bin/rgb2565 #!/bin/sh convert -depth 8 initlogo.bmp rgb:initlogo.raw ./rgb2565 -rle <initlogo.raw> initlogo.rle 拷贝initlogo.rle至/root目录 转载于:https://www.cnblogs.com/easynote/p/3454088.html

爬虫:提取网页数据的几种方法

爬虫&#xff1a;提取网页数据的几种方法 1、Beautiful Soup 2、Pyquery 3、正则表达式 4、scrapy 自己的数据提取方法 Selector(选择器) Selector 是基于lxml来构建的&#xff0c;支持XPath选择器&#xff0c;CSS选择器&#xff0c;以及正则表达式

[企业化NET]Window Server 2008 R2[3]-SVN 服务端 和 客户端 基本使用

1. 服务器基本安装即问题解决记录 √ 2. SVN环境搭建和客户端使用 2.1 服务端 和 客户端 安装 √ 2.2 项目建立与基本使用 √ 2.3 基本冲突解决,并版&#xff0c;tags 3. 数据库安装 4. 邮件服务器搭建 5. JIRA环境搭建和使用 6. CC.NET项目持续发布工具…

关于爬虫中遇到的问题

1、 ModuleNotFoundError: No module named win32api 在setting中选择安装

关于 mysql.test 数据库

国内私募机构九鼎控股打造APP&#xff0c;来就送 20元现金领取地址&#xff1a;http://jdb.jiudingcapital.com/phone.html内部邀请码&#xff1a;C8E245J &#xff08;不写邀请码&#xff0c;没有现金送&#xff09;国内私募机构九鼎控股打造&#xff0c;九鼎投资是在全国股份…

Python中strip()、lstrip()、rstrip()用法详解

Python中strip()、lstrip()、rstrip()用法详解 Python中有三个去除头尾字符、空白符的函数&#xff0c;它们依次为: strip&#xff1a; 用来去除头尾字符、空白符(包括\n、\r、\t、 &#xff0c;即&#xff1a;换行、回车、制表符、空格) lstrip&#xff1a;用来去除开头字符、…

HDU 4121 Xiangqi 模拟题

题目&#xff1a; http://acm.hdu.edu.cn/showproblem.php?pid4121 首先对标题赞一个&#xff0c;非要叫 “Xiangqi” 而不是 ”中国象棋“ 或者 ”Chinese chess“ 。。 然后是题意&#xff1a;黑棋只剩下一个”将“了&#xff0c;红棋各种 ”车” “马” “炮“&#xff0c;…

mysql在cmd命令行下的相关操作

1、设置新的root密码。 mysql -u root -p 直接回车&#xff0c;无需输入密码就可以进入数据库了。 此时在命令行下执行 use mysql &#xff08;切换到系统数据库&#xff09; 执行以下语句既可修改root用户密码&#xff1a; update user set passwordPASSWORD("123456…

python 多继承的问题

&#xff08;&#xff11;&#xff09;、关于Python支持多继承&#xff0c;如果父类中有相同的方法名&#xff0c;而在子类中调用时没有指定父类名&#xff0c;则Python解释器将从左向右按顺序进行搜索。 例如&#xff1a; class B():def a(self):print("this is B"…

python 常看

(1)、单链表的翻转 参考&#xff1a; https://www.cnblogs.com/mafeng/p/7149980.html 参考代码&#xff1a; def reverse_linkedlist2(head): if head None or head.next None: #边界条件 return head cur head #循环变量 tmp None #保存数据的临时变量 newhead None…

Android中的音频播放(MediaPlayer和SoundPool)

Android中音频和视频的播放我们最先想到的就是MediaPlayer类了&#xff0c;该类提供了播放、暂停、停止、和重复播放等方法。该类位于android.media包下&#xff0c;详见API文档。其实除了这个类还有一个音乐播放类那就是SoundPool&#xff0c;这两个类各有不同分析一下便于大家…

python中的静态方法和类方法

一、先看语法&#xff0c;python 类语法中有三种方法&#xff0c;实例方法&#xff0c;静态方法&#xff0c;类方法。 普通实例方法&#xff0c;第一个参数需要是self&#xff0c;它表示一个具体的实例本身。 如果用了staticmethod&#xff0c;那么就可以无视这个self&#xf…

我所遭遇过的中间件--VTK

我所遭遇过的中间件--VTK Vtk是我接触的第一款软件开发包,它引导我对图形学的入门.我是先学的VTK,后学的OpenGL和D3D.VTK是专为图形学开发,特点是接口清晰,好上手,又含有大量的图像处理算法.从VTK入手3D图形学,要比从OpenGL和D3D容易的多. 最初接触VTK是研一那年暑假,研一时我做…

java.lang.OutOfMemoryError: PermGen space 问题解决

Tomcat/bin/catalina.bat 或 .sh 文件中的“rem ----- Execute The Requested Command -”这个后面增加了下面的语句set JAVA_OPTS%JAVA_OPTS% -Xms256m -Xmx1024m -XX:PermSize256M -XX:MaxNewSize256m -XX:MaxPermSize512m Myeclipse配置选项 打开选项..输入tomcat关键字,然…

python中的__new__和__init__

一、__init__ 方法是什么&#xff1f; 使用Python写过面向对象的代码的同学&#xff0c;可能对 __init__ 方法已经非常熟悉了&#xff0c;__init__ 方法通常用在初始化一个类实例的时候。 这样便是__init__最普通的用法了。 但__init__其实不是实例化一个类的时候第一个被调…

python 中的__getattr__和__setattr__

__getattr__为内置方法&#xff0c;当使用点号获取实例属性时&#xff0c;如果属性不存在就自动调用__getattr__方法 __setattr__当设置类实例属性时自动调用&#xff0c;如j.name5 就会调用__setattr__方法 self.[name]5 因为这个类是从dict继承来的&#xff0c;是dict的超类 …

correct ways to define variables in python

http://stackoverflow.com/questions/9056957/correct-way-to-define-class-variables-in-python later say this转载于:https://www.cnblogs.com/luomingchuan/p/3475268.html