Csharp/C Sharp by API/System.Windows.Forms/MessageBoxButtons

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

MessageBoxButtons.OK

 
using System;
using System.Windows.Forms;
using System.Drawing;
public class DropButton {
  static void Main() {
    MessageBox.Show("You clicked the Drop button", "Button Clicked",
            MessageBoxButtons.OK, MessageBoxIcon.Information);
  }
}


MessageBoxButtons.YesNo

 
using System;
using System.Drawing;
using System.Collections;
using System.ruponentModel;
using System.Windows.Forms;
using System.Data;
public class Test{
    [STAThread]
    static void Main() 
    {
            DialogResult reply = MessageBox.Show("Question?",
            "Yes or No Demo",MessageBoxButtons.YesNo,MessageBoxIcon.Question);
      
            if (reply == DialogResult.Yes){
               MessageBox.Show("Yes");
            } else {
               MessageBox.Show("No");
            }
    }
}