C#父窗体监听子窗体事件&C#子窗体产生事件给父窗体&父窗体触发子窗体的事件&父窗体中处理子窗体控件的事件&C#使用自定义的事件委托传递消息

Flightmare实战:从零搭建强化学习无人机控制环境 本文详细介绍了从零开始搭建Flightmare强化学习无人机控制环境的完整流程。内容包括环境准备、核心库安装、依赖冲突解决,以及如何运行PPO算法示例进行训练与可视化测试。文章还提供了环境配置、自定义任务修改及常见问题的避坑指南,帮助开发者快速上手这一模块化的无人机RL仿真平台。 阅读详情

C#父窗体监听子窗体事件或在父窗体中处理子窗体控件的事件


前言

在C#程序编写过程中,我们可能会遇到子窗体点了一下按钮,或者勾选了个复选框
想让其在父窗体中处理这个事件的问题。

虽然可以通过直接将子窗体的控件变为公有属性,这样就可以直接在父窗体中绑定上这个事件。但是!!!

如果业务变得复杂,这种问题变多了,会让我们的代码耦合度非常高,可读性也会变得很差。


使用默认事件委托

子窗体代码演示

在这种情况下,我们便可以通过事件委托将这个事件抛出来达到这个目的。
下面上代码演示:

        private CheckBox[] checkboxes;//我这里有若干个控件,我希望不管勾选哪个控件父窗体都能捕获到这个事件

        public event EventHandler CANCheckedChanged;//用于抛出某个CANID选中状态改变的事件,用于父类调用
        public SelectBox()
        {
   
   
            InitializeComponent();
            checkboxes = new CheckBox[10];//这里把控件数组初始化,现在只是数组初始化完成,数组里面的对象还是空的哦
            for (int i = 0; i < checkboxes.Length; i
ksz9031 mmd读取不了_ZYNQ. LwIP.PHY.KSZ9031RNX 新一块板子米尔科技的z-turn 使用的PHY芯片是Micrel的 KSZ9031RNX 而不是zedboard上的Marvell的。直接使用lwip的echo server demo时会报错 , 无法启动。在网上找了很久终于找到几篇关于这个问题的文章。修改PHY的驱动xemacpsif_physpeed.c文件该芯片的PHY Identifier 是 0x0022bsp设置中修改参数以提速MEM... 阅读详情

相关推荐

Duilib的简单使用(五、DuiDesigner/DuiEditor的下载编译)

一、前言 在Duilib的简单使用(一、duilib demo)中我们介绍了利用duilib简单的构造一个项目 在Duilib的简单使用(二、xml实现界面与业务分离)中我们介绍了XML在duilib中的使用 在Duilib的简单使用(三、界面逻辑交互)中我们已经知道如何简单的进行界面的交互 在Duilib的简单使用(四、换肤)中,我们提了一下Duilib强大的一键换肤功能。 通过之前的说明,我们知道duilib是通过xml来分离界面和业务逻辑的,但是xml如果不能预览,那每次敲一个再运行一下看看效果,这不

LyRics1996的博客 2896

dummy机械臂代码学习(六)

CLI-Tool文件夹下又包含四个子文件夹,以及一个gitignore文件、一个run_shell.py的python文件、一个run.bat文件和一个zadig exe文件。库解析命令行参数,并根据不同的命令执行相应的操作。Zadig是一个用于Windows操作系统的开源工具,它的主要功能是安装和配置USB驱动程序。的目的呢就是确保在版本控制过程中,不必要的或自动生成的文件被忽略掉,来保持代码仓库的干净和整洁。,DummyStudio的软件作者已放在GitHub,我们主要看CLI-Tool文件夹就行。

jumaohhh的博客 1445

ROS智能车定位导航仿真+功能包自带的地图实现+自己建立的地图实现

ROS智能车定位导航仿真一、前言二、效果图三、准备工作[1.在Ubuntu上安装ROS Kinetic](https://blog.csdn.net/qq_42585108/article/details/104327661)2.创建ROS工作区间①1创建racecar_ws和src文件夹②初始化工作空间③下载racecar源代码包,并编译工程四、启动仿真1.设置环境变量2.启动地图五、建图1.启动slam和rviz2 控制车辆(左侧有个控制窗口),WASD控制前左后右的运动就可以建图了:3.新建终端保存地

qq_42585108的博客 1万+

uniapp - 实现扫码功能自定义扫描二维码/条码界面+手电筒轻触照亮+扫码屏幕添加手动输入框,手机扫描二维码并跳转过程,调用手机原生摄像头进行扫码且自动识别执行事件(uniApp安卓苹果App端)

uniapp,app端,安卓app,苹果ios,uniapp扫码识别,二维码展示和扫码,uniapp如何实现扫码功能,uni-app实现扫码功能,二维码和一维码/条码扫描,UniApp实现扫描二维码,uniapp开发原生app页面的扫码功能,自定义扫码界面,uniapp怎么调用扫一扫功能,app自定义扫码界面,uniapp 自定义扫一扫页面,扫码手电筒功能,自定义扫描框,扫码报错怎么办,扫码黑屏,扫一扫摄像头黑屏,uniapp扫码原生插件,最新扫码组件,连续扫码,uniapp APP扫码,扫码后如何处理跳转

✅ 精选推荐文章 1万+

OCR技术解析:用Tesseract和PaddleOCR识别文本

OCR技术解析:用Tesseract和PaddleOCR识别文本 ,人工智能,计算机视觉,大模型,AI,光学字符识别(Optical Character Recognition,简称 OCR)是一项将图片、扫描件等文档中的文字信息转换为可编辑文本的技术。在数字化时代,OCR 技术广泛应用于文档处理、车牌识别、身份证识别、古籍数字化等领域,极大地提高了文字信息处理的效率。Tesseract 和 PaddleOCR 是两款极具代表性的 OCR 工具。

不踩坑,不知道坑有多深;不总结,踩过的坑白踩。 3万+

docker命令_获取镜像,创建容器,启动容器,进入容器,退出容器,停止容器,删除容器,列出镜像,删除镜像

1.数据准备

C/C++、嵌入式开发、深度学习算法、模型部署与推理优化 1089

基于Python的异步爬虫实战:高效抓取同花顺概念板块数据

本文将详细介绍如何使用Python最新异步爬虫技术(requests-html+aiohttp+selenium)高效抓取同花顺概念板块数据。内容涵盖:反爬机制破解、动态页面渲染处理、数据解析存储等完整流程,并提供可复用的高性能爬虫代码实现。高性能:异步并发处理,QPS可达50+高可用:完善的异常处理机制可扩展:支持分布式部署增加历史数据回溯功能集成机器学习识别验证码构建实时数据推送系统。

2201_76125261的博客 1544

直捣黄龙~

这篇文章描述了一个矩阵寻路问题,要求计算从起点到终点的最短路径数量及长度。主要思路是通过BFS算法解决:首先标记哨兵警戒区域为禁区,然后从起点出发进行广度优先搜索,记录每个位置的最短步数和路径条数。当到达终点时,输出路径数和步数;若不可达则返回(0,0)。算法使用队列实现BFS,同时处理路径统计和步数记录,适用于网格寻路类问题。

面试高手的博客 228

jre9下载 jdk9

(Java SE Runtime Environment 9.0) 9.0u175 官方最新版 【x86|x64】

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain&#39;s apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = &quot;R. B. Palm&quot;, title = &quot;Prediction as a candidate for learning deep hierarchical models of data&quot;, year = &quot;2012&quot;,}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath(&#39;DeepLearnToolbox&#39;));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand(&#39;state&#39;,0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W&#39;); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand(&#39;state&#39;,0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = &#39;sigm&#39;;%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.10, &#39;Too big error&#39;);```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand(&#39;state&#39;,0)sae = saesetup([784 100]);sae.ae{1}.activation_function = &#39;sigm&#39;;sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)&#39;)% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;;nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.16, &#39;Too big error&#39;);```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x&#39;,28,28,60000))/255;test_x = double(reshape(test_x&#39;,28,28,10000))/255;train_y = double(train_y&#39;);test_y = double(test_y&#39;);%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you&#39;ll get around 1.2% errorrand(&#39;state&#39;,0)cnn.layers = { struct(&#39;type&#39;, &#39;i&#39;) %input layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 6, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %sub sampling layer struct(&#39;type&#39;, &#39;c&#39;, &#39;outputmaps&#39;, 12, &#39;kernelsize&#39;, 5) %convolution layer struct(&#39;type&#39;, &#39;s&#39;, &#39;scale&#39;, 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er&lt;0.12, &#39;Too big error&#39;);```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.08, &#39;Too big error&#39;);%% ex2 neural net with L2 weight decayrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex3 neural net with dropoutrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex4 neural net with sigmoid activation functionrand(&#39;state&#39;,0)nn = nnsetup([784 100 10]);nn.activation_function = &#39;sigm&#39;; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex5 plotting functionalityrand(&#39;state&#39;,0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = &#39;softmax&#39;; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand(&#39;state&#39;,0)nn = nnsetup([784 20 10]); nn.output = &#39;softmax&#39;; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er &lt; 0.1, &#39;Too big error&#39;);```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free &quot;Bitdeli Badge&quot;)

Camera2Demo

在Camera2 的基础上进行封装,使得Camera2一堆初始化逻辑与Activity分离,降低耦合度,完成预览拍照并保存的操作

上一篇: C++USB通信。使用hidapi库与控制板通信。C++与hid设备通信。hidapi库的配置与使用。
下一篇: 第一章、C#最简单的控制台网络通信&C#最简单的控制台socket通信&两个控制台聊天
jumul
博客等级 码龄7年 42粉丝 20原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

jumul

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值