开发者论坛

 找回密码
 注册 (请使用非IE浏览器)
查看: 7882|回复: 0

[教程] DEV 中RichEditControl 设置改变段落默认格式

[复制链接]

0

精华

105

贡献

309

赞扬

正版授权组

Rank: 14Rank: 14Rank: 14Rank: 14

帖子
68
软币
905
在线时间
81 小时
注册时间
2014-2-12
发表于 2014-11-5 09:25:20 | 显示全部楼层 |阅读模式
[C#] 纯文本查看 复制代码
using DevExpress.XtraRichEdit;
using DevExpress.XtraRichEdit.Utils;
using DevExpress.XtraRichEdit.API.Native;
using DevExpress.Office.Utils;

            Document doc = richEditControl1.Document;
            DocumentPosition pos = doc.Selection.Start;
            DocumentRange range = doc.CreateRange(pos, 0);
            ParagraphProperties pp = doc.BeginUpdateParagraphs(range);
            // Center paragraph
            pp.Alignment = ParagraphAlignment.Center;
            // Set triple spacing
            pp.LineSpacingType = ParagraphLineSpacing.Multiple;
            pp.LineSpacingMultiplier = 3;
            // Set left indent at 0.5".
            // Default unit is 1/300 of an inch (a document unit).
            pp.LeftIndent = Units.InchesToDocumentsF(0.5f);
            // Set tab stop at 1.5"
            TabInfoCollection tbiColl = pp.BeginUpdateTabs(true);
            TabInfo tbi = new TabInfo();
            tbi.Alignment = TabAlignmentType.Center;
            tbi.Position = Units.InchesToDocumentsF(1.5f);
            tbiColl.Add(tbi);
            pp.EndUpdateTabs(tbiColl);
            doc.EndUpdateParagraphs(pp);

评分

参与人数 4赞扬 +4 收起 理由
deng123 + 1 很给力
嘿黑丶 + 1 很给力
a3398200 + 1 赞一个
982071787 + 1 <font style="vertical-align: inh

查看全部评分

回复

使用道具 举报

Archiver|手机版|小黑屋|开发者网 ( 苏ICP备08004430号-2 )
版权所有:南京韵文教育信息咨询有限公司

GMT+8, 2024-6-5 21:30

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表