C# Winform编程(3)对话框

C# Winform编程(3)对话框

  • Show(string text);
  • Show(string text, string caption);
  • Show(string text, string caption, MessageBoxButtons buttons);
  • Show(string text, string caption, MessageBoxButtons buttons, MessageBoxIcon icon);
csharp 复制代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace 对话框
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {

        }

        private void button1_Click(object sender, EventArgs e)
        {
            MessageBox.Show("只有消息文本的对话框!");
        }

        private void button2_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题");
        }

        private void button3_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.OK);
        }

        private void button4_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.OKCancel);
        }

        private void button5_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo);
        }

        private void button6_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNoCancel);
        }

        private void button7_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.RetryCancel);
        }

        private void button8_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.AbortRetryIgnore);
        }

        private void button9_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
        }

        private void button10_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
        }

        private void button11_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
        }

        private void button12_Click(object sender, EventArgs e)
        {
            MessageBox.Show("消息文本", "标题", MessageBoxButtons.YesNo, MessageBoxIcon.Exclamation);
        }
    }
}
相关推荐
南极星10051 小时前
蓝桥杯JAVA--启蒙之路(十)class版本 模块
java·开发语言
baidu_247438611 小时前
Android ViewModel定时任务
android·开发语言·javascript
Dev7z1 小时前
基于 MATLAB 的铣削切削力建模与仿真
开发语言·matlab
不能隔夜的咖喱1 小时前
牛客网刷题(2)
java·开发语言·算法
小天源1 小时前
Error 1053 Error 1067 服务“启动后立即停止” Java / Python 程序无法后台运行 windows nssm注册器下载与报错处理
开发语言·windows·python·nssm·error 1053·error 1067
肉包_5112 小时前
两个数据库互锁,用全局变量互锁会偶发软件卡死
开发语言·数据库·c++
大空大地20262 小时前
流程控制语句--if语句
开发语言
毕设源码-邱学长3 小时前
【开题答辩全过程】以 基于PHP的发热病人管理平台的设计与实现为例,包含答辩的问题和答案
开发语言·php
HellowAmy3 小时前
我的C++规范 - 线程池
开发语言·c++·代码规范
独自破碎E3 小时前
【BISHI9】田忌赛马
android·java·开发语言