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);
        }
    }
}
相关推荐
serendipity_hky15 分钟前
【go语言 | 第6篇】Go Modules 依赖解决
开发语言·后端·golang
小oo呆28 分钟前
【学习心得】Python的TypedDict(简介)
开发语言·python
文洪涛32 分钟前
VS Code Python “第一次运行失败 / 先执行 python 再激活 Conda” 问题定位与解决
开发语言·python·conda
自己的九又四分之三站台40 分钟前
基于OpenCV扶正扫描文件
人工智能·opencv·计算机视觉·c#
wanghowie41 分钟前
01.08 Java基础篇|设计模式深度解析
java·开发语言·设计模式
FuckPatience1 小时前
C# 获取属性自定义特性报错:System.NotSupportedException:“泛型类型无效。
c#
wjs20241 小时前
Memcached stats 命令详解
开发语言
云技纵横1 小时前
Stream API 从入门到实践:常用操作、易错点与性能建议
开发语言·windows·python
Knight_AL1 小时前
Java 17 新特性深度解析:记录类、密封类、模式匹配与增强的 switch 表达式对比 Java 8
java·开发语言