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);
        }
    }
}
相关推荐
优橙教育1 小时前
5G网优培训 vs Java开发:转行选哪个?
java·开发语言·5g
SeaTunnel3 小时前
从 Python Script 地狱到标准化数据集成框架
大数据·开发语言·python·程序员·代码·seatunnel
碎光拾影3 小时前
ARM交叉工具链各工具作用及IMX6ULL平台LED+蜂鸣器裸机程序实现
java·开发语言·数据库
Marst Code4 小时前
(python)2026Plotly 库评估:交互式可视化到底值不值得引入?
开发语言·python
Miao121314 小时前
微服务 API 测试实践:海外某民宿平台如何构建模式驱动测试基础设施
java·开发语言
CRMEB系统商城5 小时前
开源自建还是SaaS订阅?算一笔3年经济账
java·大数据·开发语言·开源
keyipatience6 小时前
线程栈与TLS和线程互斥
java·linux·服务器·开发语言·ubuntu
我的xiaodoujiao6 小时前
快速学习Python基础知识详细图文教程9--函数进阶
开发语言·python·学习·测试工具
爱喝水的鱼丶7 小时前
SAP-ABAP:ALV通用封装实践——搭建可复用的ALV开发工具类,减少80%重复代码
开发语言·性能优化·sap·abap·erp·alv
脱胎换骨-军哥7 小时前
C++/Rust无缝互操作:混合系统新常态
开发语言·c++·rust