在WPF RichTextBox中心设置当前的保留位置? [英] Set Current caretposition in WPF richtextbox center?

查看:57
本文介绍了在WPF RichTextBox中心设置当前的保留位置?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经使用了下面的代码.它将当前插入符号的位置移动到视口顶部.

 <代码样式="边距:0px;填充:0px;边框:0px;字体大小:13px;字体系列:Consolas,Menlo,摩纳哥,'Lucida Console ','解放Mono','DejaVu Sans Mono','Bitstream Vera Sans Mono','Courier New',monospace,sans-serif; white-space:inherit> FrameworkContentElement fce =(tpNextLine2.Parent as FrameworkContentElement);
如果(fce!= null)
{
    fce.BringIntoView();
}  

另一个方法是

 rtb.ScrollToVerticalOffset(rc.Top + rtb.VerticalOffset) ;  

我想在Richtextbox的居中和顶部位置设置当前的重排文本指针,我的意思是使用WPF将每个单词从中心移到左侧.并突出显示插入符号位置的单词 在Richtextbox的顶部居中位置.

我该如何实现?

问候

Sanju

解决方案

嗨Sanju Monu,
 
>> 我想在RichTextBox中设置当前的插入位置文本指针 居中 居首位
您希望插入符号显示在顶部和中心位置吗?
 
>> 我的意思是使用WPF将每个单词从中心移到左侧
这是否意味着文本对齐?
 
如果能提供一张显示预期效果的图片,那就更好了.
 
最好的问候,
安妮维亚·陈(Annievia Chen)


I already used the below code. It moves current caret position in viewport top.

FrameworkContentElement fce = (tpNextLine2.Parent as FrameworkContentElement);
if (fce != null)
{
    fce.BringIntoView();
}

the another method is,

rtb.ScrollToVerticalOffset(rc.Top + rtb.VerticalOffset);

I want to Set current caretposition textpointer in richtextbox  Center  top position,i mean move each word from center to left side using WPF. And also highlight that caret position word  in the center top position of the richtextbox. 

How can I achieve this?

Regards

Sanju

解决方案

Hi Sanju Monu,
 
>>I want to Set current caretposition textpointer in richtextbox  Center  top position
Do you expect the caret show itself on the top and in the Center ?
 
>>I mean move each word from center to left side using WPF
Does this mean alignment of the text?
 
And it would be better If you could provide a picture showing the expected effect.
 
Best Regards,
Annievia Chen


这篇关于在WPF RichTextBox中心设置当前的保留位置?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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