文章目录
我将从Message的作用,用法(参数),图标,自定义及实例5个方面来解释,需要的可以跳转
正文
释义:
作用:
Message.Show()
注意: 4个参数除了Text外都可以省略,Text也可以用""输出无内容提示框C#代码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 WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
MessageBox.Show("");
}
}
}
结果:

只显示信息
MessageBox.Show("Error!");

加上标题
MessageBox.Show("马老师,发生了甚么事","Error!");

弹出框的类型
MessageBoxButtons.AbortRetryIgnore
MessageBox.Show("马老师,发生了甚么事","Error!",MessageBoxButtons.AbortRetryIgnore);

OKCancel
MessageBox.Show("马老师,发生了甚么事","Error!",MessageBoxButtons.OKCancel);

RetryCancel
MessageBox.Show("这瓜保熟吗?","Error!",MessageBoxButtons.RetryCancel);

YesNo
MessageBox.Show("我能卖给你生瓜蛋子吗?","Error!",MessageBoxButtons.YesNo);

YesNoCancel
MessageBox.Show("你能记得你吃过多少面包片吗?","Error!",MessageBoxButtons.YesNoCancel);

第4个参数是指图标
Asterisk
MessageBox.Show("人行道上不是很宽敞吗?","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Asterisk);

Error
MessageBox.Show("人行道上不是很宽敞吗?","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Error);

Exclamation
MessageBox.Show("人行道上不是很宽敞吗?","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Exclamation);

Hand
MessageBox.Show("人行道上不是很宽敞吗?","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Hand);

Information
MessageBox.Show("今天也是ViVi的男孩","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Information);

None
MessageBox.Show("今天也是ViVi的男孩","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.None);

Question
MessageBox.Show("肥肉肥肉咔嚓减掉","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Question);

Stop
MessageBox.Show("禁止中小学生引用纯净水?","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Stop);

Warning
MessageBox.Show("《本草纲目》","Error!",MessageBoxButtons.YesNoCancel,MessageBoxIcon.Warning);

问题
假如我想改变提示框的字体大小或者颜色,Windows自带的提示框就不行了。
思路
自己建立一个新的Form,之后放入Label和Button,之后用Form.ShowDialog的方法显示出来
简单实现
新建windowsForms项目

简单设计
就是拖动两个按钮,文本框和图片框,只用作显示,没有写逻辑,需要可以自定义
Form1

Form2

懒惰使我不想搞得太花里胡哨,但是你可以按照自己的心意修改
Form1代码
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 test4
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
InputDialog.Show();
}
}
}
都是系统自动生成的,只有一句方法调用
InputDialog.cs代码
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace test4
{
class InputDialog
{
public static DialogResult Show()
{
Form2 inputDialog = new Form2();
DialogResult result = inputDialog.ShowDialog();
return result;
}
}
}
运行结果


这里我贴一个以前做来传递参数的例子
说明:
利用弹出框获取用户输入的值,并更改原有文本数值
代码Form1.cs
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 test3
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
string str = strText.Text;
str = string.Empty;
InputDialog.Show(out str);
MessageBox.Show("strText的值是:" + str, "");
strText.Text = str;
}
}
}
代码InputDialog.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace test3
{
public static class InputDialog
{
public static DialogResult Show(out string strText)
{
string strTemp = string.Empty;
FrmInputDialog inputDialog = new FrmInputDialog();
inputDialog.TextHandler = (str) => { strTemp = str; };
DialogResult result = inputDialog.ShowDialog();
strText = strTemp;
return result;
}
}
}
FrmInputDialog
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 test3
{
public partial class FrmInputDialog : Form
{
public delegate void TextEventHandler(string strText);
public TextEventHandler TextHandler;
public FrmInputDialog()
{
InitializeComponent();
}
private void btnOK_Click(object sender, EventArgs e)
{
if (null != TextHandler)
{
TextHandler.Invoke(txtString.Text);
DialogResult = DialogResult.OK;
}
}
private void btnCancel_Click(object sender, EventArgs e)
{
DialogResult = DialogResult.Cancel;
}
private void txtString_KeyPress(object sender, KeyPressEventArgs e)
{
//如果输入的不是退格和数字,则屏蔽输入
//if (!(e.KeyChar == '\b' || (e.KeyChar >= '0' && e.KeyChar <= '9')))
//{
// e.Handled = true;
//}
if (Keys.Enter == (Keys)e.KeyChar)
{
if (null != TextHandler)
{
TextHandler.Invoke(txtString.Text);
DialogResult = DialogResult.OK;
}
}
}
private void txtString_TextChanged(object sender, EventArgs e)
{
int i;
if (int.TryParse(txtString.Text, out i) == false)
{
txtString.Text = " ";
}
}
private void FrmInputDialog_Load(object sender, EventArgs e)
{
}
}
}
Form1设计

FrmInputDialog设计

实现效果




后续我写出其它的样式或者应用到也会陆续贴上来
学习方法:
参考资料.图标大全
一、什么是MQTT协议MessageQueuingTelemetryTransport:消息队列遥测传输协议。是一种基于客户端-服务端的发布/订阅模式。与HTTP一样,基于TCP/IP协议之上的通讯协议,提供有序、无损、双向连接,由IBM(蓝色巨人)发布。原理:(1)MQTT协议身份和消息格式有三种身份:发布者(Publish)、代理(Broker)(服务器)、订阅者(Subscribe)。其中,消息的发布者和订阅者都是客户端,消息代理是服务器,消息发布者可以同时是订阅者。MQTT传输的消息分为:主题(Topic)和负载(payload)两部分Topic,可以理解为消息的类型,订阅者订阅(Su
TCL脚本语言简介•TCL(ToolCommandLanguage)是一种解释执行的脚本语言(ScriptingLanguage),它提供了通用的编程能力:支持变量、过程和控制结构;同时TCL还拥有一个功能强大的固有的核心命令集。TCL经常被用于快速原型开发,脚本编程,GUI和测试等方面。•实际上包含了两个部分:一个语言和一个库。首先,Tcl是一种简单的脚本语言,主要使用于发布命令给一些互交程序如文本编辑器、调试器和shell。由于TCL的解释器是用C\C++语言的过程库实现的,因此在某种意义上我们又可以把TCL看作C库,这个库中有丰富的用于扩展TCL命令的C\C++过程和函数,所以,Tcl是
开门见山|拉取镜像dockerpullelasticsearch:7.16.1|配置存放的目录#存放配置文件的文件夹mkdir-p/opt/docker/elasticsearch/node-1/config#存放数据的文件夹mkdir-p/opt/docker/elasticsearch/node-1/data#存放运行日志的文件夹mkdir-p/opt/docker/elasticsearch/node-1/log#存放IK分词插件的文件夹mkdir-p/opt/docker/elasticsearch/node-1/plugins若你使用了moba,直接右键新建即可如上图所示依次类推创建
文章目录概念索引相关操作创建索引更新副本查看索引删除索引索引的打开与关闭收缩索引索引别名查询索引别名文档相关操作新建文档查询文档更新文档删除文档映射相关操作查询文档映射创建静态映射创建索引并添加映射概念es中有三个概念要清楚,分别为索引、映射和文档(不用死记硬背,大概有个印象就可以)索引可理解为MySQL数据库;映射可理解为MySQL的表结构;文档可理解为MySQL表中的每行数据静态映射和动态映射上面已经介绍了,映射可理解为MySQL的表结构,在MySQL中,向表中插入数据是需要先创建表结构的;但在es中不必这样,可以直接插入文档,es可以根据插入的文档(数据),动态的创建映射(表结构),这就
HTTP缓存是指浏览器或者代理服务器将已经请求过的资源保存到本地,以便下次请求时能够直接从缓存中获取资源,从而减少网络请求次数,提高网页的加载速度和用户体验。缓存分为强缓存和协商缓存两种模式。一.强缓存强缓存是指浏览器直接从本地缓存中获取资源,而不需要向web服务器发出网络请求。这是因为浏览器在第一次请求资源时,服务器会在响应头中添加相关缓存的响应头,以表明该资源的缓存策略。常见的强缓存响应头如下所述:Cache-ControlCache-Control响应头是用于控制强制缓存和协商缓存的缓存策略。该响应头中的指令如下:max-age:指定该资源在本地缓存的最长有效时间,以秒为单位。例如:Ca
如何用IDEA2022创建并初始化一个SpringBoot项目?目录如何用IDEA2022创建并初始化一个SpringBoot项目?0. 环境说明1. 创建SpringBoot项目 2.编写初始化代码0. 环境说明IDEA2022.3.1JDK1.8SpringBoot1. 创建SpringBoot项目 打开IDEA,选择NewProject创建项目。 填写项目名称、项目构建方式、jdk版本,按需要修改项目文件路径等信息。 选择springboot版本以及需要的包,此处只选择了springweb。 此处需特别注意,若你使用的是jdk1
前言上一篇我们简要讲述了粒子系统是什么,如何添加,以及基本模块的介绍,以及对于曲线和颜色编辑器的讲解。从本篇开始,我们将按照模块结构讲解下去,本篇主要讲粒子系统的主模块,该模块主要是控制粒子的初始状态和全局属性的,以下是关于该模块的介绍,请大家指正。目录前言本系列提要一、粒子系统主模块1.阅读前注意事项2.参考图3.参数讲解DurationLoopingPrewarmStartDelayStartLifetimeStartSpeed3DStartSizeStartSize3DStartRotationStartRotationFlipRotationStartColorGravityModif
VMware虚拟机与本地主机进行磁盘共享前提虚拟机版本为Windows10(专业版,不是可能有问题)本地主机为家庭版或学生版(此版本会有问题,但有替代方式)最好是专业版VMware操作1.关闭防火墙,全部关闭。2.打开电脑属性3.点击共享-》高级共享-》权限4.如果没有everyone,就添加权限选择完全控制,然后应用确定。5.打开cmd输入lusrmgr.msc(只有专业版可以打开)如果不是专业版,可以跳过这一步。点击用户-》administrator密码要复杂密码,否则不行。推荐admaiN@1234类型的密码。设置完密码,点击属性,将禁用解开。6.如果虚拟机的windows不是专业版,可
IK分词器本文分为简介、安装、使用三个角度进行讲解。简介倒排索引众所周知,ES是一个及其强大的搜索引擎,那么它为什么搜索效率极高呢,当然和他的存储方式脱离不了关系,ES采取的是倒排索引,就是反向索引;常见索引结构几乎都是通过key找value,例如Map;倒排索引的优势就是有效利用Value,将多个含有相同Value的值存储至同一位置。分词器为了配合倒排索引,分词器也就诞生了,只有合理的利用Value,才会让倒排索引更加高效,如果一整个Value不进行任何操作直接进行存储,那么Value和key毫无区别。分词器Analyzer通常会对Value进行操作:一、字符过滤,过滤掉html标签;二、分
题外话:抑郁场,开局一小时只出A,死活想不来B,最后因为D题出锅ura才保住可怜的分。但咱本来就写不到DB-LongLegs(数论)本题题解法一学自同样抑郁的知乎作者幽血魅影的题解,有讲解原理。法二来着知乎巨佬cup-pyy(大佬说《不难发现》呜呜)题意三种操作:向上走mmm步向右走mmm步给自己一次走的步数加111,即使得m=m+1m=m+1m=m+1问从(0,0)(0,0)(0,0)走到(a,b)(a,b)(a,b)的最小操作次数,值得注意的是操作三不可逆。解析假设我们最终一步的大小增长到mmm,那么在这个过程中我能以[1,m][1,m][1,m](当步数增长到该数时)之间的任何数字向上或