用于更改RTB中文本的按钮? [英] button for change the text in the RTB ?

查看:61
本文介绍了用于更改RTB中文本的按钮?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


Hi

我做了一些代码已经有很长时间了。所以我忘记了基本的b
我想要做的是当我点击(粗体或斜体)按钮时,RTB上的文字变为粗体,再按一下该按钮,文本恢复正常。

It been long time since i do some codes. so i forget the basic
What i want to do is that when i click on a (Bold or Italic) button the text on the RTB become bold and another click on that button the text go back normal.

请问一些代码吗?

谢谢

推荐答案

您好

以下是可以解决的问题:

Here is something to work on:

BOLD

		' bold
		If Not RTB.SelectionFont Is Nothing Then
			Dim cf As System.Drawing.Font = RTB.SelectionFont
			Dim nf As System.Drawing.FontStyle
			If RTB.SelectionFont.Bold = True Then
				nf = FontStyle.Regular
			Else
				nf = FontStyle.Bold
			End If
			RTB.SelectionFont = New Font(cf.FontFamily, cf.Size, nf)
		End If

ITALIC

' italic
		If Not RTB.SelectionFont Is Nothing Then
			Dim cf As System.Drawing.Font = RTB.SelectionFont
			Dim nf As System.Drawing.FontStyle
			If RTB.SelectionFont.Italic = True Then
				nf = FontStyle.Regular
			Else
				nf = FontStyle.Italic
			End If
			RTB.SelectionFont = New Font(cf.FontFamily, cf.Size, nf)
		End If


这篇关于用于更改RTB中文本的按钮?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆