Enum JustificationMode

JustificationMode enumeration

Mode perataan teks.

public enum JustificationMode

Nilai

NamaNilaiKeterangan
Left0Teks rata kiri.
Right1Teks rata kanan.
Center2Teks tengah.

Contoh

Kode berikut menunjukkan dukungan enum JustificationMode untuk menyetel perataan teks untuk bagian teks.

[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());
}

Lihat juga