找回密码
 立即注册

QQ登录

只需一步,快速开始

mindrayguowei

中级会员

122

主题

274

帖子

986

积分

中级会员

积分
986

活字格认证

QQ
mindrayguowei
中级会员   /  发表于:2017-1-9 14:12  /   查看:2941  /  回复:4
我想要调用TextControl.Selection.IncreaseIndent()来实现首行缩进两格, 但是调用这个方法会导致很多行缩进, 而且缩进的很多. 查看帮助文档只有简单的一句描述:

Increases the left indent of all paragraphs contained in the current text selection. If no text is selected, this method increases the left indent at the text input position. left indent positions are defined through the paragraphs' tab positions and the indents of the paragraphs in front and behind the paragraph with the text input position.

我看了一下这个tab position是定义在TextControl.ParagraphFormat.TabPositions,但是这个是一个长度为14的数组.

请问我要把TabPositions的值改成什么? 才能实现我一段选中的文字里面的第一行缩进两格.
这个长度为14的数组里面的每个值都代表什么意思? 文档里面没有任何详细的说明, 也找不到相关的demo程序.

4 个回复

倒序浏览
gw0506
超级版主   /  发表于:2017-1-9 18:04:03
沙发
这个和TabPosition应该没有关系,TabPosition是等分宽度的。

TX自带的  ParagraphFormatDialog中有首行缩进的设置以及悬挂缩进的设置。但是ParagraphFormat中只有HangingIndent,的确找不到对应的属性设置。
我跟厂商确认一下。
回复 使用道具 举报
gw0506
超级版主   /  发表于:2017-1-9 18:52:38
板凳
  1.             TXTextControl.ParagraphFormat firstLineIndent = new TXTextControl.ParagraphFormat();
  2.             firstLineIndent.LeftIndent = 300;
  3.             firstLineIndent.HangingIndent = -300;
  4.             textControl1.Selection.ParagraphFormat = firstLineIndent;
复制代码
回复 使用道具 举报
mindrayguowei
中级会员   /  发表于:2017-1-10 14:38:57
地板
你这个可以实现一段文字的第一行缩进吗? 怎么确定第一行?
回复 使用道具 举报
gw0506
超级版主   /  发表于:2017-1-10 15:41:38
5#
你试试就知道了。这个其实就是有点取巧,先全部做左缩进,然后把悬挂缩进给个负值,就倒过来成首行缩进了。悬挂缩进和首行所及刚好是反的,一个是第一行短,一个是第一行长。
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部