RichTextBox.SelectionRightIndent Properti
Definisi
Penting
Beberapa informasi terkait produk prarilis yang dapat diubah secara signifikan sebelum dirilis. Microsoft tidak memberikan jaminan, tersirat maupun tersurat, sehubungan dengan informasi yang diberikan di sini.
Jarak (dalam piksel) antara tepi RichTextBox kanan kontrol dan tepi kanan teks yang dipilih atau ditambahkan pada titik penyisipan saat ini.
public:
property int SelectionRightIndent { int get(); void set(int value); };
[System.ComponentModel.Browsable(false)]
public int SelectionRightIndent { get; set; }
[<System.ComponentModel.Browsable(false)>]
member this.SelectionRightIndent : int with get, set
Public Property SelectionRightIndent As Integer
Nilai Properti
Ruang indentasi, dalam piksel, di sebelah kanan pilihan atau titik penyisipan saat ini.
- Atribut
Contoh
Contoh kode berikut menunjukkan cara membuat margin kanan dalam RichTextBox menggunakan SelectionRightIndent properti . Contohnya mengharuskan Anda memiliki formulir yang berisi RichTextBox kontrol bernama richTextBox1
, dan kode contoh dipanggil dari peristiwa dalam kelas formulir.
private:
void WriteIndentedTextToRichTextBox()
{
// Clear all text from the RichTextBox;
richTextBox1->Clear();
// Specify a 20 pixel right indent in all paragraphs.
richTextBox1->SelectionRightIndent = 20;
// Set the font for the text.
richTextBox1->Font = gcnew System::Drawing::Font( "Lucinda Console",12 );
// Set the text within the control.
richTextBox1->SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
richTextBox1->SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
richTextBox1->SelectedText = "After this paragraph the indentation will end.\n\n";
// Remove all right indentation.
richTextBox1->SelectionRightIndent = 0;
richTextBox1->SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
}
private void WriteIndentedTextToRichTextBox()
{
// Clear all text from the RichTextBox;
richTextBox1.Clear();
// Specify a 20 pixel right indent in all paragraphs.
richTextBox1.SelectionRightIndent = 20;
// Set the font for the text.
richTextBox1.Font = new Font("Lucinda Console", 12);
// Set the text within the control.
richTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox.";
richTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins.";
richTextBox1.SelectedText = "After this paragraph the indentation will end.\n\n";
// Remove all right indentation.
richTextBox1.SelectionRightIndent = 0;
richTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal.";
}
Private Sub WriteIndentedTextToRichTextBox()
' Clear all text from the RichTextBox;
RichTextBox1.Clear()
' Set the font for the text.
RichTextBox1.Font = New Font("Lucinda Console", 12)
' Specify a 20 pixel right indent in all paragraphs.
RichTextBox1.SelectionRightIndent = 20
' Set the text within the control.
RichTextBox1.SelectedText = "All text is indented 20 pixels from the right edge of the RichTextBox."
RichTextBox1.SelectedText = "You can use this property with the SelectionIndent property to provide right and left margins."
RichTextBox1.SelectedText = "After this paragraph the indentation will end." + ControlChars.CrLf
' Remove all right indentation.
RichTextBox1.SelectionRightIndent = 0
RichTextBox1.SelectedText = "This paragraph has no right indentation. All text should flow as normal."
End Sub
Keterangan
Jika saat ini tidak ada teks yang dipilih, pengaturan indentasi diterapkan ke paragraf tempat titik penyisipan muncul dan ke semua teks yang diketik ke dalam kontrol setelah titik penyisipan. Pengaturan indentasi berlaku hingga properti diubah ke nilai yang berbeda atau hingga titik penyisipan dipindahkan ke paragraf yang berbeda dalam kontrol.
Jika teks dipilih dalam kontrol, teks yang dipilih dan teks apa pun yang dimasukkan setelah pemilihan teks akan memiliki nilai properti ini yang diterapkan padanya. Anda dapat menggunakan properti ini untuk mengindentasi paragraf yang terkandung dalam dokumen RichTextBox. Anda dapat menggunakan properti ini bersama dengan SelectionIndent untuk membuat paragraf yang ditampilkan dalam paragraf.
Untuk membuat inden gantung untuk paragraf dalam kontrol, gunakan SelectionHangingIndent properti .
Berlaku untuk
Saran dan Komentar
https://aka.ms/ContentUserFeedback.
Segera hadir: Sepanjang tahun 2024 kami akan menghentikan penggunaan GitHub Issues sebagai mekanisme umpan balik untuk konten dan menggantinya dengan sistem umpan balik baru. Untuk mengetahui informasi selengkapnya, lihat:Kirim dan lihat umpan balik untuk