DialogResult的使用方法

发布时间:2025-12-09 11:47:34 浏览次数:2

using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Linq;using System.Text;using System.Windows.Forms;namespace _2014050904DialogResult{    public partial class Form1 : Form    {        public Form1()        {            InitializeComponent();        }        public string message = "You did not enter a server name. Cancel this operation?";        public string caption = "No Server Name Specified";        public MessageBoxButtons buttons = MessageBoxButtons.YesNo;        public DialogResult result;        public void show()        {            //显示MessageBox.            result = MessageBox.Show(this, message, caption, buttons);            //如果点击的是"YES"按钮,将form关闭.            if (result == DialogResult.Yes)            {                // Closes the parent form.                this.Close();            }        }        private void Form1_Load(object sender, EventArgs e)        {            show();        }    }}

152172.html

dialogresult
需要做网站?需要网络推广?欢迎咨询客户经理 13272073477