RichTextBox.ZoomFactor 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
取得或設定當前的縮放等級 RichTextBox。
public:
property float ZoomFactor { float get(); void set(float value); };
public float ZoomFactor { get; set; }
member this.ZoomFactor : single with get, set
Public Property ZoomFactor As Single
屬性值
控制內容被放大的因子。
例外狀況
指定的變焦因子未落在允許範圍內。
範例
以下程式碼範例示範如何建立 RichTextBox 一個能放大文字、雙擊字詞時自動選取控制項文字中的字詞,並在控制項客戶端右側有邊界。 如果控制 RichTextBox 鍵寬度較小,使用此程式碼會產生 RichTextBox 一個字元顯示在獨立行的欄位。 在此垂直顯示位置時,點擊單字的任何部分,無論文字是否垂直顯示,都會選取該單字的所有字元。 這個範例要求你有一個包含 RichTextBox 名為 richTextBox1的控制項的表單。
private:
void ZoomMyRichTextBox()
{
// Enable users to select entire word when double clicked.
richTextBox1->AutoWordSelection = true;
// Clear contents of control.
richTextBox1->Clear();
// Set the right margin to restrict horizontal text.
richTextBox1->RightMargin = 2;
// Set the text for the control.
richTextBox1->SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot";
// Zoom by 2 points.
richTextBox1->ZoomFactor = 2.0f;
}
private void ZoomMyRichTextBox()
{
// Enable users to select entire word when double clicked.
richTextBox1.AutoWordSelection = true;
// Clear contents of control.
richTextBox1.Clear();
// Set the right margin to restrict horizontal text.
richTextBox1.RightMargin = 2;
// Set the text for the control.
richTextBox1.SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot";
// Zoom by 2 points.
richTextBox1.ZoomFactor = 2.0f;
}
Private Sub ZoomMyRichTextBox()
' Enable users to select entire word when double clicked.
richTextBox1.AutoWordSelection = True
' Clear contents of control.
richTextBox1.Clear()
' Set the right margin to restrict horizontal text.
richTextBox1.RightMargin = 2
' Set the text for the control.
richTextBox1.SelectedText = "Alpha Bravo Charlie Delta Echo Foxtrot"
' Zoom by 2 points.
richTextBox1.ZoomFactor = 2.0F
End Sub
備註
此物業價值介於1/64(0.015625)至64.0之間,不包含。 值為 1.0 表示控制器未被調整變焦。 當文件包含 TrueType 字型時,縮放功能表現最佳。 當控制項文件中使用非 TrueType 字型時,屬性 ZoomFactor 會使用最接近的整數值。 你可以利用這個特性,讓控制項的使用者 RichTextBox 能夠放大到文件中太小無法查看的區段,或是將視圖壓縮,讓更多文件能在螢幕上顯示。