RichTextBox控件,首行缩进代码

来源:百度知道 编辑:UC知道 时间:2024/07/09 04:38:54
VB中怎样用RichTextBox控件实现首行缩进?代码是什么?

请看下面代码:
RichTextBox.SelIndent = 600 '缩进每段的首行
RichTextBox.SelHangingIndent = -200 '在首行缩进的情况下缩进其它行
RichTextBox.SelRightIndent = 100 '段的右缩进

先执行下面两行,将段落全部选中
RichTextBox1(0).SelStart =??
RichTextBox1(0).SelLength =??
再执行下面两行

RichTextBox1(0).SelIndent = 450
RichTextBox1(0).SelHangingIndent = -450
下面两行的意思是,先将段落整体向右缩进450像素

再将(除段落首行外的文字)想左缩进450像素

总共加起来就是首行向右缩进450像素

450像素大约就是两个中文字符的长度。