登录
首页 » C#源码 » C# 返回用户点击按钮的枚举

C# 返回用户点击按钮的枚举

于 2023-02-16 发布 文件大小:22.07 kB
0 229
下载积分: 2 下载次数: 1

代码说明:

C# 返回用户点击按钮的枚举,这个比较有点个性了,平时好像用的不多,返回用户单击按钮后的信息,需要进行用户单击的判断,代码如下:   DialogResult dr = MessageBox.Show("消息信息", "标题", MessageBoxButtons.YesNoCancel);   switch (dr)//使用switch语句判断用户点击了哪个按钮   {    case DialogResult.Cancel://如果按下了Cancel则执行下面的语句块    MessageBox.Show("按下了Cancel");    break;    case DialogResult.No://如果按下了No则执行下面的语句块    MessageBox.Show("按下了No");    break;    case DialogResult.Yes://如果按下了Yes则执行下面的语句块    MessageBox.Show("按下了Yes");    break;   }

下载说明:请别用迅雷下载,失败请重下,重下不扣分!

发表评论

0 个回复

  • C# WPF演示窗体模式的切换
    C# WPF演示窗体模式的切换,可以切换到拖放模式,切换到编辑模式。编辑模式切换的例子。
    2022-05-14 05:31:05下载
    积分:1
  • ATK-ESP8266 WIFI模块资料
    1、ATK-ESP8266 WIFI 模块简介 ATK-ESP8266 是 ALIENTEK 推出的一款高性能的 UART-WiFi(串口-无线)模块,ATK-ESP8266 板载ai-thinker公司的ESP8266模块,该模块通过 FCC,CE认证,可直接用于产品出口欧美地区。 ATK-ESP8266模块采用串口(LVTTL)与MCU(或其他串口设备)通信,内置 TCP/IP协议栈,能够实现串口与WIFI之间的转换。 通过 ATK-ESP8266 模块,传统的串口设备只是需要简单的串口配置,即可通过网络(WIFI)传输自己的数据。 ATK-ESP8266 模块支持 LVTTL串口,兼容3.3V和5V单片机系统,可以很方便的与你的产品进行连接。模块支持串口转 WIFI STA、串口转 AP 和WIFI STA+WIFI AP 的模式,从而快速构建串口-WIFI数据传输方案,方便你的设备使用互联网传输数据。 ATK-ESP8266 29mm*19mm 6 2.54mm
    2022-08-13 08:01:09下载
    积分:1
  • C# WPF 功能打印的示例
    C# WPF 功能打印的示例,加载内容后,可在本程序中直接打印出XAML文档。   private void button2_Click(object sender, RoutedEventArgs e)   {//打印文件    PrintDialog MyDialog = new PrintDialog();    if ((MyDialog.ShowDialog() == true))    {    MyDialog.PrintVisual(this.richTextBox1 as Visual, "我的XAML打印文档");    }   }   private void button3_Click(object sender, RoutedEventArgs e)   {//保存文件    string MyFileName = "MyFile.XAML";    TextRange MyTextRange;    System.IO.FileStream MyStream;    MyTextRange = new TextRange(this.richTextBox1.Document.ContentStart, this.richTextBox1.Document.ContentEnd);    MyStream = new System.IO.FileStream(MyFileName, System.IO.FileMode.Create);    MyTextRange.Save(MyStream, DataFormats.XamlPackage);    MyStream.Close();   }
    2022-01-23 10:57:00下载
    积分:1
  • CA 源码 ciso
    数字证书的demo程序,用于KPI建设。基于openssl实现。采用vc6.0编译。
    2022-06-28 03:32:13下载
    积分:1
  • C#合成图片 组合文字及图像的实例
    C# 将多个文字图形图像组合成复合图形,一个组合文字及图像的实例。基于WPF技术实现,可作为一个C#学习WPF图像处理的简单范例。C# 将多个文字图形图像组合成复合图形:   DrawingGroup MyGroup = new DrawingGroup();   RadialGradientBrush MyRadialGradientBrush = new RadialGradientBrush();   MyRadialGradientBrush.Freeze();   FontStyle MyStyle = FontStyles.Normal;   FontWeight MyWeight = FontWeights.Medium;   MyWeight = FontWeights.Bold;   MyStyle = FontStyles.Italic;   string MyText = "Visual C++ 2017源码素材网实例精粹罗斌编著";   var MyFont = new FontFamily("宋体");   FormattedText MyFormattedText = new FormattedText(MyText,    System.Globalization.CultureInfo.GetCultureInfo(86),    FlowDirection.RightToLeft,    new Typeface(MyFont, MyStyle, MyWeight, FontStretches.Normal),    FontSize, MyRadialGradientBrush);   Pen MyPen = new Pen(Brushes.Black, 2);   MyPen.Freeze();   ……   更多源代码敬请下载本源码。运行截图如下图所示。
    2022-06-30 08:36:55下载
    积分:1
  • C# WinForm版 附加数据库
    附加数据库程序,C# WinForm版 附加数据库,附加SQLSERVER数据库的MDF和LDF文件,在SQL企业管理器中就可完成这项功能。
    2022-03-23 13:53:28下载
    积分:1
  • C# 为textBox文本框控件添加颜色光环
    C# 为文本框控件添加颜色光环,是不是把textBox装扮得很漂亮呢?外发光的文本框,有点沙沙的感觉,核心代码有兴趣可参考:   private void Window_Loaded(object sender, RoutedEventArgs e)   {//为文本框控件添加颜色光环    var MyOuterGlowBitmapEffect = new System.Windows.Media.Effects.OuterGlowBitmapEffect();    MyOuterGlowBitmapEffect.GlowSize = 30;    Color MyColor = new Color();    MyColor.ScA = 1;    MyColor.ScB = 1;    MyColor.ScG = 0;    MyColor.ScR = 0;    MyOuterGlowBitmapEffect.GlowColor = MyColor;    MyOuterGlowBitmapEffect.Noise = 1;    MyOuterGlowBitmapEffect.Opacity =0.8;    this.textBox1.BitmapEffect = MyOuterGlowBitmapEffect;   }   完整的C#可编译源代码,请下载本源码。
    2022-07-09 20:47:57下载
    积分:1
  • C# 显示DataGridView控件中选定的单元格、行和列
    Visual C#显示选择的DataGridView单元格,获取DataGridView控件中选定的单元格、行和列,测试前请连接好数据库,实现此功能核心代码如下:   if (customersDataGridView.AreAllCellsSelected(true))   {    MessageBox.Show("所有单元格已经被选择!", "信息提示",MessageBoxButtons.OK);   }   else   {    System.Text.StringBuilder MyInfo =new System.Text.StringBuilder();    for (int i = 0;    i < MyCount; i++)    {    MyInfo.Append("行号: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].RowIndex.ToString());    MyInfo.Append(", 列号: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].ColumnIndex.ToString());    MyInfo.Append(", 单元格值: ");    MyInfo.Append(customersDataGridView.SelectedCells[i].Value.ToString());    MyInfo.Append(Environment.NewLine);    }    MyInfo.Append("一共选择了: " + MyCount.ToString()+"个单元格");    MessageBox.Show(MyInfo.ToString(), "信息提示", MessageBoxButtons.OK);   }
    2022-03-18 13:11:05下载
    积分:1
  • C#以二进制格式打开和保存文件
    C#使用BinaryWriter、BinaryReader对象分别保存和读取二进制文件,程序分两部分,先来看第一部分:   C#以二进制格式保存文件:设置保存文件的格式:   saveFileDialog1.Filter = "二进制文件(*.dat)|*.dat";   if (saveFileDialog1.ShowDialog() == DialogResult.OK)   {    //使用“另存为”对话框中输入的文件名实例化FileStream对象    FileStream myStream = new FileStream(saveFileDialog1.FileName, FileMode.OpenOrCreate, FileAccess.ReadWrite);    //使用FileStream对象实例化BinaryWriter二进制写入流对象    BinaryWriter myWriter = new BinaryWriter(myStream);    //以二进制方式向创建的文件中写入内容    myWriter.Write(textBox1.Text);    //关闭当前二进制写入流    myWriter.Close();    //关闭当前文件流    myStream.Close();    textBox1.Text = string.Empty;   }   打开文件时同样也是以二进制来打开读取文件内容:   //设置打开文件的格式   openFileDialog1.Filter = "二进制文件(*.dat)|*.dat";   if (openFileDialog1.ShowDialog() == DialogResult.OK)   {    textBox1.Text = string.Empty;    //使用“打开”对话框中选择的文件名实例化FileStream对象    FileStream myStream = new FileStream(openFileDialog1.FileName, FileMode.Open, FileAccess.Read);    //使用FileStream对象实例化BinaryRea
    2022-02-14 18:03:07下载
    积分:1
  • 7Zip
    This file is part of SevenZipSharp.    SevenZipSharp is free software: you can redistribute it and/or modify    it under the terms of the GNU Lesser General Public License as published by    the Free Software Foundation, either version 3 of the License, or    (at your option) any later version.    SevenZipSharp is distributed in the hope that it will be useful,    but WITHOUT ANY WARRANTY; without even the implied warranty of    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the    GNU Lesser General Public License for more details.    You should have received a copy of the GNU Lesser General Public License    along with SevenZipSharp.  If not, see .
    2022-07-20 00:09:31下载
    积分:1
  • 696516资源总数
  • 106914会员总数
  • 0今日下载