RichTextBox.SelectionRightIndent 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
控制項右邊 RichTextBox 與當前插入點所選或新增文字右邊之間的距離(以像素計)。
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
屬性值
縮排空間,以像素為單位,位於當前選取點或插入點右側。
- 屬性
範例
以下程式碼範例示範如何使用 屬性在 中RichTextBoxSelectionRightIndent建立右邊界。 範例要求你有一個表單包含 RichTextBox 一個名為 richTextBox1的控制項,且範例程式碼是從表單類別中的事件中呼叫的。
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
備註
若目前未選取任何文字,縮排設定會套用到插入點所在段落及插入點後輸入控制項的所有文字。 縮排設定會持續使用,直到屬性被更改為其他值,或插入點被移至控制項內的其他段落。
若在控制項內選取文字,所選文字及後輸入的任何文字都會套用此屬性的值。 你可以利用此特性縮排文件中 RichTextBox段落。 你可以將此特性與 結合 SelectionIndent ,建立以段落形式顯示的段落。
若要在控制項中為段落建立懸掛縮排,請使用該 SelectionHangingIndent 屬性。