FontDialog.ShowApply 屬性

定義

取得或設定值,指出對話方塊是否包含 [套用] 按鈕。

public:
 property bool ShowApply { bool get(); void set(bool value); };
public bool ShowApply { get; set; }
member this.ShowApply : bool with get, set
Public Property ShowApply As Boolean

屬性值

true 如果對話方塊包含 [ 套用 ] 按鈕,則為 ;否則為 false 。 預設值是 false

範例

下列程式碼範例示範如何將 中的 FontDialog 選取範圍套用至 中的 RichTextBox 文字。 在顯示對話方塊的事件處理常式中,此範例會將 屬性初始化 ShowApplytrue ,然後顯示 FontDialog 。 在事件處理常式中 ApplyFont ,屬性會指派給 Control.Font 屬性。

private:
   void button1_Click( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Sets the ShowApply property, then displays the dialog.
      fontDialog1->ShowApply = true;
      fontDialog1->ShowDialog();
   }

   void fontDialog1_Apply( Object^ /*sender*/, System::EventArgs^ /*e*/ )
   {
      // Applies the selected font to the selected text.
      richTextBox1->Font = fontDialog1->Font;
   }

private void button1_Click(object sender, System.EventArgs e)
{
    // Sets the ShowApply property, then displays the dialog.

    fontDialog1.ShowApply = true;
    fontDialog1.ShowDialog();
}

private void fontDialog1_Apply(object sender, System.EventArgs e)
{
    // Applies the selected font to the selected text.
    richTextBox1.Font = fontDialog1.Font;
}
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

    ' Sets the ShowApply property, then displays the dialog.
    FontDialog1.ShowApply = True
    FontDialog1.ShowDialog()

End Sub

Private Sub FontDialog1_Apply(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FontDialog1.Apply

    ' Applies the selected font to the selected text.
    RichTextBox1.SelectionFont = FontDialog1.Font

End Sub

適用於

另請參閱