次の方法で共有


FontDialog.ShowApply プロパティ

ダイアログ ボックスに Apply ボタンを表示するかどうかを示す値を取得または設定します。

Public Property ShowApply As Boolean
[C#]
public bool ShowApply {get; set;}
[C++]
public: __property bool get_ShowApply();public: __property void set_ShowApply(bool);
[JScript]
public function get ShowApply() : Boolean;public function set ShowApply(Boolean);

プロパティ値

ダイアログ ボックスに Apply ボタンを表示する場合は true 。それ以外の場合は false 。既定値は false です。

使用例

[Visual Basic, C#, C++] FontDialog での選択を RichTextBox 内のテキストに適用する方法を次の例に示します。この例では、ダイアログ ボックスを表示するイベント ハンドラで ShowApply プロパティを true に初期化してから FontDialog を表示しています。 Apply イベント ハンドラで、 Font プロパティは Control.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

[C#] 

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;
            
}

[C++] 
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;

    }

[JScript] JScript のサンプルはありません。Visual Basic、C#、および C++ のサンプルを表示するには、このページの左上隅にある言語のフィルタ ボタン 言語のフィルタ をクリックします。

必要条件

プラットフォーム: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 ファミリ

参照

FontDialog クラス | FontDialog メンバ | System.Windows.Forms 名前空間 | ShowColor | ShowEffects | ShowHelp