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);
        }
    }
}
相关推荐
qq_4312807011 分钟前
上位与基恩士PLC通讯工作记录
c#
笨笨饿18 分钟前
74_SysTick滴答定时器中断
c语言·开发语言·人工智能·单片机·嵌入式硬件·算法·学习方法
科芯创展35 分钟前
XZ4058B/C,20V,外置MOS,8.4V/8.7V开关充电芯片 宽范围电源电压:8.9V~20V-(电池充电电压:8.4V/8.7V)
c语言·开发语言
AI玫瑰助手42 分钟前
Python流程控制:break与continue语句的区别与应用
开发语言·python·信息可视化
largecode1 小时前
如何让电话显示店名?来电显示店铺名称,提升有效接通率
java·开发语言·spring·百度·学习方法·业界资讯·twitter
xuhaoyu_cpp_java1 小时前
SpringMVC学习(五)
java·开发语言·经验分享·笔记·学习·spring
Aurorar0rua2 小时前
CS50 x 2024 Notes C -11
c语言·开发语言·学习方法
Dlrb12112 小时前
C语言-指针
c语言·开发语言
zhangzhi19798155922 小时前
Agent Skills
开发语言·python