winform中e.concel用法,是干啥的?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了winform中e.concel用法,是干啥的?相关的知识,希望对你有一定的参考价值。

winform中e.concel用法,是干什么的?在什么时候用?它的意思是什么。

最好有一个实例来说明。

在FormClosing事件中有一个事件数据e,他里面的Cancel属性,代表的是要如何处理这个事件。实际窗口关闭是发生在FormClosed事件中的,而FormClosing事件是在激发FormClosed之前发生的。这时窗口是准备要关闭但还没有真正执行关闭。

如果你通过业务处理发现不需要关闭这个窗口,那么就让e.Cancel=true。意思就是是否要取消关闭事件呢?答案是取消。这样窗口就不会触发FormClosed事件而关闭窗口了。
参考技术A if (MessageBoxShow.ShowTwoChoMessage("确认关闭窗体?", strTitle) == DialogResult.Cancel)

e.Cancel = true;

就是弹出的对话框中取消按钮这个动作为真。
参考技术B 是状态标示吧 当一个窗体为对话框模式的时候 关闭窗体的时候可以选择传出 这个参数 标示 确定 取消等状态 参考技术C e。cancel吧?
e.Cancel = true;
是说取消这个事件的状态

iOS 中 NSParameterAssert 是干啥的之官方解释翻译篇

 

技术分享

 

 

断言评估一个条件,如果条件为 false ,调用当前线程的断点句柄。每一个线程有它自已的断点句柄,它是一个 NSAsserttionHandler 类的对象。当被调用时,断言句柄打印一个错误信息,该条信息中包含了方法名、类名或函数名。然后,它就抛出一个 NSInternalInconsistencyException 异常。
Assertions evaluate a condition and, if the condition evaluates to false, call the assertion handler for the current thread, passing it a format string and a variable number of arguments. Each thread has its own assertion handler, which is an object of classNSAssertionHandler. When invoked, an assertion handler prints an error message that includes method and class names (or the function name). It then raises anNSInternalInconsistencyException exception.

这个宏用于确认一个 Objective-C 的方法的有效性。简单提供参数作为条件就行。该宏评估这个参数,如果为 false ,它就打印一个错误日志信息,该信息包含了参数并且抛出一个异常。
This macro validates a parameter for an Objective-C method. Simply provide the parameter as the condition argument. The macro evaluates the parameter and, if it is false, it logs an error message that includes the parameter and then raises an exception.

如果定义了预处理宏 NS_BLOCK_ASSERTIONS 断言就被禁止了。所有的断点宏都返回 void。
Assertions are disabled if the preprocessor macro NS_BLOCK_ASSERTIONS is defined. All assertion macros return void.

以上是关于winform中e.concel用法,是干啥的?的主要内容,如果未能解决你的问题,请参考以下文章

java中Arraylist是干啥的?怎么用?

装了个deepin系统 高级选项里是干啥的

async中await是干啥的,用不用有什么区别?

c语言中啥是宏定义,它是干啥的?

Java的JAR包, EAR包 ,WAR包 都是干啥的,有啥区别

@Reference是干啥的