C# 类似QQ消息框的有格式的文本

Forever_Newer 2008-12-17 02:13:42
我想做一个类似QQ的消息框:

昵称1 2008-1-1 10:00:00
你好!!(红色字体,10号字)
昵称2 2008-1-1 10:01:00
哈喽!(绿色字体,8号字)

如上,就是在RichTextBox添加行,但是怎么样才能像QQ那样,字体有自定义的格式呢??
谢谢~~~~~~~~
...全文
161 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
cja03 2009-03-11
  • 打赏
  • 举报
回复
http://album.hi.csdn.net/views/photo/283932
Forever_Newer 2008-12-17
  • 打赏
  • 举报
回复
结贴 谢谢楼上的!~~
wartim 2008-12-17
  • 打赏
  • 举报
回复
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WindowsFormsApplication6
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
int Start;

richTextBox1.AppendText("昵称1 2008-1-1 10:00:00" + Environment.NewLine);
Start = richTextBox1.TextLength;
richTextBox1.AppendText("你好!!" + Environment.NewLine);
richTextBox1.SelectionStart = Start;
richTextBox1.SelectionLength = richTextBox1.TextLength - Start;
richTextBox1.SelectionFont = new Font("宋体", 10);
richTextBox1.SelectionColor = Color.Red;
richTextBox1.AppendText("昵称2 2008-1-1 10:01:00 " + Environment.NewLine);
Start = richTextBox1.TextLength;
richTextBox1.AppendText("哈喽!" + Environment.NewLine);
richTextBox1.SelectionStart = Start;
richTextBox1.SelectionLength = richTextBox1.TextLength - Start;
richTextBox1.SelectionFont = new Font("宋体", 8);
richTextBox1.SelectionColor = Color.Green;

richTextBox1.SelectionStart = richTextBox1.TextLength;
}
}
}
fenglm999 2008-12-17
  • 打赏
  • 举报
回复
你可以使用FontDialog这个类来做啊,你查查有好多例子的
Forever_Newer 2008-12-17
  • 打赏
  • 举报
回复
大家帮帮忙撒~~~
wb186 2008-12-17
  • 打赏
  • 举报
回复
一起学习
Forever_Newer 2008-12-17
  • 打赏
  • 举报
回复
自定义控件?怎么个思路?详细点行吗?
卧_槽 2008-12-17
  • 打赏
  • 举报
回复
自定义控件吧

110,545

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

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