Enum JustificationMode
JustificationMode enumeration
文本对齐方式。
public enum JustificationMode
价值观
姓名 | 价值 | 描述 |
---|---|---|
Left | 0 | 左对齐文本. |
Right | 1 | 右对齐文本. |
Center | 2 | 中心文字. |
例子
以下代码演示了对 JustificationMode 枚举的支持以设置文本部分的文本对齐方式。
[C#]
string src = "source1107.psd";
string outputPsd = "output.psd";
string outputPng = "output.png";
using (var image = (PsdImage) Image.Load(src))
{
var txtLayer = image.AddTextLayer("Text line1\rText line2\rText line3",
new Rectangle(200, 200, 500, 500));
var portions = txtLayer.TextData.Items;
portions[0].Paragraph.Justification = JustificationMode.Left;
portions[1].Paragraph.Justification = JustificationMode.Right;
portions[2].Paragraph.Justification = JustificationMode.Center;
foreach (var portion in portions)
{
portion.Style.FontSize = 24;
}
txtLayer.TextData.UpdateLayerData();
image.Save(outputPsd);
image.Save(outputPng, new PngOptions());
}