RichEditControl 光标定位问题

王安之 2012-05-08 03:02:50
在C#中 使用Devexpress 中的RichEditControl 怎样定位光标??? 让光标一直在文本的最下面,输出自动滚动到最后输出的一行???求助。。。。
...全文
638 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
chenxs_91 2013-05-14
  • 打赏
  • 举报
回复 1
引用 14 楼 shiliujing 的回复:
如果是滚动条的问题的话可以在 this.richEdit.Document.CaretPosition = this.richEdit.Document.Range.End; 后面加 richEditControl.ScrollToCaret();
这种方法可行!
王安之 2012-05-15
  • 打赏
  • 举报
回复
分马上给。
王安之 2012-05-15
  • 打赏
  • 举报
回复
这两天没上网。刚才试了一下。
你说的方法管用。谢谢啦!!
shiliujing 2012-05-12
  • 打赏
  • 举报
回复
如果是滚动条的问题的话可以在
this.richEdit.Document.CaretPosition = this.richEdit.Document.Range.End;
后面加
richEditControl.ScrollToCaret();
shiliujing 2012-05-12
  • 打赏
  • 举报
回复
可能是光标已经过去了。。。可是滚动条没有下去。。。
shiliujing 2012-05-12
  • 打赏
  • 举报
回复
那你这段赋值的代码是在哪个事件中执行的。。。
shiliujing 2012-05-10
  • 打赏
  • 举报
回复
[Quote=引用 6 楼 的回复:]
也不行啊。。。。
我是给richEditControl的Text 赋的值
[/Quote]

我给Text赋过值,焦点也是到文本的最后的,是不是哪里写的不对啊。这段代码是放在赋值以前还是以后,放在以前没用的。
王安之 2012-05-10
  • 打赏
  • 举报
回复
还是不行啊哥哥。没有SelectionStart 这个属性
Conmajia 2012-05-10
  • 打赏
  • 举报
回复
.Text.Length - 1

不然要越界
Conmajia 2012-05-10
  • 打赏
  • 举报
回复
.SelectionStart = .Text.Length;
.SelectionLength = 0;
王安之 2012-05-10
  • 打赏
  • 举报
回复
也不行啊。。。。
我是给richEditControl的Text 赋的值
王安之 2012-05-10
  • 打赏
  • 举报
回复
我是这样写的 richEdit 就是richEditControl
代码:
this.richEdit.Text = ButtomMessage;

this.richEdit.Document.CaretPosition = this.richEdit.Document.Range.End;
出来的效果是没有光标,滚动条在最上面。
shiliujing 2012-05-09
  • 打赏
  • 举报
回复

richEditControl.Document.CaretPosition = richEditControl.Document.Range.End;
王安之 2012-05-09
  • 打赏
  • 举报
回复
我用的不是自带控件 用的是第三方的
Developer Express v2010 vol 2 里的RichEditControl

我这样写:
this.richEditControl.ScrollToCaret();
但是还是不行。
csrwgs 2012-05-08
  • 打赏
  • 举报
回复
用C#自带控件的话
richTextBox1.ScrollToCaret()
王安之 2012-05-08
  • 打赏
  • 举报
回复
你确定吗???我刚才试了下。不行。RichEditControl 的 Select 没有参数的。
boyqing 2012-05-08
  • 打赏
  • 举报
回复
与RichEditControl一样的:
rtbDisplay.Select(_Number, 1);
rtbDisplay.SelectionColor = Color.Yellow;
rtbDisplay.SelectionBackColor = Color.Red;

rtbDisplay.Select(_Number, 1);
rtbDisplay.SelectionColor = Color.Black;
rtbDisplay.SelectionBackColor = Color.FromArgb(240, 238, 209);

111,126

社区成员

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

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

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