RichTextBox中实现选中文字的粗体,斜体,删除线,下划线,颜色 (答对就给分结贴)

wenjunsu 2008-10-18 10:44:12
RT!
我的开发平台是Visual Studio 2008,开发语言是vb.net
最先回答正确的,分就给你了!
麻烦各位了!谢谢!
...全文
355 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangyanboq 2008-10-18
  • 打赏
  • 举报
回复
richTextBox1.SelectionStart = 0;
richTextBox1.SelectionLength = 3;

Font oldFont = this.richTextBox1.SelectionFont;
Font newFont = new Font(oldFont, oldFont.Style | FontStyle.Bold | FontStyle.Italic | FontStyle.Underline | FontStyle.Strikeout);
richTextBox1.SelectionFont = newFont;
richTextBox1.SelectionColor = Color.Red;
ZengHD 2008-10-18
  • 打赏
  • 举报
回复
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Ariel", 20, FontStyle.Bold or FontStyle.Italic or FontStyle.Strikeout or FontStyle.Underline )
End Sub
wenjunsu 2008-10-18
  • 打赏
  • 举报
回复
虽然不是我的要求,算了,GF!
wenjunsu 2008-10-18
  • 打赏
  • 举报
回复
是分开实现,不是在一起实现!
是点击一个按钮,实现一个特征!
比如点击button1,实现选中字的粗体
比如点击button2,实现选中字的斜体
Bullatus 2008-10-18
  • 打赏
  • 举报
回复
[Quote=引用 1 楼 ZengHD 的回复:]
VB.NET code Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
RichTextBox1.SelectionColor = Color.Red
RichTextBox1.SelectionFont = New Font("Ariel", 20, FontStyle.Bold or FontStyle.Italic or FontStyle.Strikeout or FontStyle.Underline )
End Sub
[/Quote]
就是这样的

16,555

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧