C# 使用对话框

在Windows编程中,我们经常使用到对话框。
但我们需要确保对话框不会自动打开。

C# 实现对话框示例

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 WindowsFormsApplication11
{
    public partial class Form1 : Form
    {
        public Form1()
        {
            InitializeComponent();
        }
        private void Form1_Load(object sender, EventArgs e)
        {
        }
        private void button1_Click(object sender, EventArgs e)
        {
            DialogResult result = openFileDialog1.ShowDialog();
            if (result == DialogResult.OK)
            {
            }
            Console.WriteLine(result);
        }
    }
}
日期:2020-04-11 23:03:55 来源:oir作者:oir