C# Winform的三态CheckBox,以及批量修改Panel中的控件

在C# WinForms中,如果你想批量修改一个Panel容器内的所有CheckBox控件的状态,你可以使用foreach循环来遍历PanelControls集合。下面是一个示例,展示了如何将一个Panel内所有的CheckBox控件设为选中状态(Checked = true)。

但是要开发如下的界面,有几个重点要考虑:

1. 三态CheckBox,请参考下面代码实现

2. Panel控件中事件的挂载,控件的遍历。如果有不清晰的,请评论反馈我们讨论。

using Infrastructure;
using LatCall.Core;
using LatCall.Service;
using LatRcs.Model.Domain;
using Sunny.UI;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Diagnostics.Eventing.Reader;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;namespace LatRcs.CallPlatform.FrmSetting
{public partial class FEditRight : UIEditForm{public sysRole CurrentRole { get; set; }public bool IsAddNew { get; internal set; } = true;public FEditRight(sysRole role = null){InitializeComponent();foreach (var item in pnlMenu.Controls){if (item is System.Windows.Forms.Panel){Panel panelCtl = (Panel)item;//强制转换foreach (CheckBox ck in panelCtl.Controls){ck.CheckedChanged += MenuControl_CheckedChanged;}}}if (role != null){IsAddNew = false;CurrentRole = role;txtRoleName.Text = CurrentRole.RoleName;txtRoleDescription.Text = CurrentRole.Remark;foreach (var roleMenu in role.SysRoleMenuList){foreach (var ChkMenu in pnlMenu.Controls){if (ChkMenu is System.Windows.Forms.CheckBox){CheckBox theBox = (CheckBox)ChkMenu;//强制转换if (theBox.Tag.ToString() == roleMenu.MenuID.ToString()){theBox.Checked = true;}}}                        }}}private void MenuControl_CheckedChanged(object sender, EventArgs e){CheckBox c = sender as CheckBox;var menuLevel = int.Parse(c.Tag.ToString());Panel editPanel = null;if (menuLevel < 2000){editPanel = panel1;}else if (menuLevel < 3000){editPanel = panel2;}else if (menuLevel < 4000){editPanel = panel3;}else if (menuLevel < 5000){editPanel = panel4;}//.....CheckBox rootCheck = (CheckBox)editPanel.Controls[0];if (c == rootCheck){if (rootCheck.CheckState == CheckState.Checked){for (int i = 1; i < editPanel.Controls.Count; i++){CheckBox theCheckBox = (CheckBox)editPanel.Controls[i];theCheckBox.Checked = true;}}else {rootCheck.CheckState = CheckState.Unchecked;for (int i = 1; i < editPanel.Controls.Count; i++){CheckBox theCheckBox = (CheckBox)editPanel.Controls[i];rootCheck.CheckedChanged -= MenuControl_CheckedChanged;theCheckBox.Checked = false;rootCheck.CheckedChanged += MenuControl_CheckedChanged;}}return;}if (c.Checked == true){bool allChecked = true;for(int i = 1; i< editPanel.Controls.Count; i++) {CheckBox theCheckBox = (CheckBox)editPanel.Controls[i];allChecked = allChecked && theCheckBox.Checked;                    }                if (allChecked == true){rootCheck.CheckState = CheckState.Checked;return;}else{bool allUnChecked = true;for (int i = 1; i < editPanel.Controls.Count; i++){CheckBox theCheckBox = (CheckBox)editPanel.Controls[i];allUnChecked = allUnChecked && !theCheckBox.Checked;}if (allUnChecked == true){rootCheck.CheckState = CheckState.Unchecked;return;}else{rootCheck.CheckedChanged -= MenuControl_CheckedChanged;rootCheck.CheckState = CheckState.Indeterminate;rootCheck.CheckedChanged += MenuControl_CheckedChanged;}}}else{bool allUnChecked = true;for (int i = 1; i < panel1.Controls.Count; i++){CheckBox theCheckBox = (CheckBox)panel1.Controls[i];allUnChecked = allUnChecked && !theCheckBox.Checked;}if (allUnChecked == true){rootCheck.CheckState = CheckState.Unchecked;return;}else{rootCheck.CheckedChanged -= MenuControl_CheckedChanged;rootCheck.CheckState = CheckState.Indeterminate;rootCheck.CheckedChanged += MenuControl_CheckedChanged;}}}protected override bool CheckData(){return CheckEmpty(txtRoleName, "请输入角色名称")&& CheckEmpty(txtRoleDescription, "请输入备注");}private void btnOK_Click(object sender, EventArgs e){if (!CheckValid()){this.IsOK = false;this.DialogResult = DialogResult.None;return;}if (CurrentRole == null){CurrentRole = new sysRole();CurrentRole.ID = CoreData.MaxRoleID + 1;}CurrentRole.RoleName = txtRoleName.Text;CurrentRole.Remark = txtRoleDescription.Text;CurrentRole.SysRoleMenuList.Clear();foreach (CheckBox chkMenu in pnlMenu.Controls)//有checkBox所以需要循环{if (chkMenu != null && chkMenu.Checked){var roleMenu = new sysRoleMenu();roleMenu.RoleID = CurrentRole.ID;roleMenu.MenuID = int.Parse(chkMenu.Tag.ToString());CurrentRole.SysRoleMenuList.Add(roleMenu);}}}private bool CheckValid(){bool hasSameName = CoreData.AllRoles.Where(p => p.RoleName == txtRoleName.Text).Any();if (hasSameName && IsAddNew){Comm.InfoMessage("角色名已经存在,请重新输入!");txtRoleName.Focus();txtRoleName.SelectAll();return false;}return true;}private void FEditRight_Load(object sender, EventArgs e){}private void btnCancel_Click(object sender, EventArgs e){//this.IsOK = false;//this.DialogResult = DialogResult.None;}}
}
namespace LatRcs.CallPlatform.FrmSetting
{partial class FEditRight{/// <summary>/// Required designer variable./// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// Clean up any resources being used./// </summary>/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows Form Designer generated code/// <summary>/// Required method for Designer support - do not modify/// the contents of this method with the code editor./// </summary>private void InitializeComponent(){this.uiLabel1 = new Sunny.UI.UILabel();this.uiLabel2 = new Sunny.UI.UILabel();this.txtRoleName = new Sunny.UI.UITextBox();this.txtRoleDescription = new Sunny.UI.UITextBox();this.uiLabel3 = new Sunny.UI.UILabel();this.pnlMenu = new System.Windows.Forms.Panel();this.panel2 = new System.Windows.Forms.Panel();this.chkHisttoryRoot = new System.Windows.Forms.CheckBox();this.checkBox7 = new System.Windows.Forms.CheckBox();this.chkWork = new System.Windows.Forms.CheckBox();this.chkTask = new System.Windows.Forms.CheckBox();this.checkBox13 = new System.Windows.Forms.CheckBox();this.checkBox12 = new System.Windows.Forms.CheckBox();this.checkBox9 = new System.Windows.Forms.CheckBox();this.checkBox10 = new System.Windows.Forms.CheckBox();this.checkBox11 = new System.Windows.Forms.CheckBox();this.panel1 = new System.Windows.Forms.Panel();this.checkBox1 = new System.Windows.Forms.CheckBox();this.checkBox2 = new System.Windows.Forms.CheckBox();this.checkBox3 = new System.Windows.Forms.CheckBox();this.checkBox8 = new System.Windows.Forms.CheckBox();this.panel3 = new System.Windows.Forms.Panel();this.panel4 = new System.Windows.Forms.Panel();this.pnlBtm.SuspendLayout();this.pnlMenu.SuspendLayout();this.panel2.SuspendLayout();this.panel1.SuspendLayout();this.panel3.SuspendLayout();this.panel4.SuspendLayout();this.SuspendLayout();// // pnlBtm// this.pnlBtm.Location = new System.Drawing.Point(1, 317);this.pnlBtm.Size = new System.Drawing.Size(680, 55);// // btnCancel// this.btnCancel.Location = new System.Drawing.Point(552, 12);this.btnCancel.Click += new System.EventHandler(this.btnCancel_Click);// // btnOK// this.btnOK.Location = new System.Drawing.Point(437, 12);this.btnOK.Click += new System.EventHandler(this.btnOK_Click);// // uiLabel1// this.uiLabel1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.uiLabel1.Location = new System.Drawing.Point(42, 65);this.uiLabel1.Name = "uiLabel1";this.uiLabel1.Size = new System.Drawing.Size(82, 25);this.uiLabel1.TabIndex = 2;this.uiLabel1.Text = "角色名称";this.uiLabel1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;// // uiLabel2// this.uiLabel2.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.uiLabel2.Location = new System.Drawing.Point(42, 109);this.uiLabel2.Name = "uiLabel2";this.uiLabel2.Size = new System.Drawing.Size(89, 26);this.uiLabel2.TabIndex = 3;this.uiLabel2.Text = "备注";this.uiLabel2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;// // txtRoleName// this.txtRoleName.ButtonSymbolOffset = new System.Drawing.Point(0, 0);this.txtRoleName.Cursor = System.Windows.Forms.Cursors.IBeam;this.txtRoleName.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.txtRoleName.Location = new System.Drawing.Point(131, 65);this.txtRoleName.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);this.txtRoleName.MinimumSize = new System.Drawing.Size(1, 16);this.txtRoleName.Name = "txtRoleName";this.txtRoleName.Padding = new System.Windows.Forms.Padding(5);this.txtRoleName.ShowText = false;this.txtRoleName.Size = new System.Drawing.Size(220, 34);this.txtRoleName.TabIndex = 4;this.txtRoleName.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;this.txtRoleName.Watermark = "";// // txtRoleDescription// this.txtRoleDescription.ButtonSymbolOffset = new System.Drawing.Point(0, 0);this.txtRoleDescription.Cursor = System.Windows.Forms.Cursors.IBeam;this.txtRoleDescription.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.txtRoleDescription.Location = new System.Drawing.Point(131, 109);this.txtRoleDescription.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);this.txtRoleDescription.MinimumSize = new System.Drawing.Size(1, 16);this.txtRoleDescription.Name = "txtRoleDescription";this.txtRoleDescription.Padding = new System.Windows.Forms.Padding(5);this.txtRoleDescription.ShowText = false;this.txtRoleDescription.Size = new System.Drawing.Size(220, 34);this.txtRoleDescription.TabIndex = 4;this.txtRoleDescription.TextAlignment = System.Drawing.ContentAlignment.MiddleLeft;this.txtRoleDescription.Watermark = "";// // uiLabel3// this.uiLabel3.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.uiLabel3.Location = new System.Drawing.Point(33, 151);this.uiLabel3.Name = "uiLabel3";this.uiLabel3.Size = new System.Drawing.Size(71, 26);this.uiLabel3.TabIndex = 5;this.uiLabel3.Text = "角色权限";this.uiLabel3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;// // pnlMenu// this.pnlMenu.Controls.Add(this.panel4);this.pnlMenu.Controls.Add(this.panel3);this.pnlMenu.Controls.Add(this.panel2);this.pnlMenu.Controls.Add(this.panel1);this.pnlMenu.Location = new System.Drawing.Point(110, 151);this.pnlMenu.Name = "pnlMenu";this.pnlMenu.Size = new System.Drawing.Size(463, 158);this.pnlMenu.TabIndex = 6;// // panel2// this.panel2.Controls.Add(this.chkHisttoryRoot);this.panel2.Controls.Add(this.checkBox7);this.panel2.Controls.Add(this.chkWork);this.panel2.Controls.Add(this.chkTask);this.panel2.Location = new System.Drawing.Point(30, 44);this.panel2.Name = "panel2";this.panel2.Size = new System.Drawing.Size(420, 37);this.panel2.TabIndex = 7;// // chkHisttoryRoot// this.chkHisttoryRoot.AutoSize = true;this.chkHisttoryRoot.Location = new System.Drawing.Point(3, 14);this.chkHisttoryRoot.Name = "chkHisttoryRoot";this.chkHisttoryRoot.Size = new System.Drawing.Size(90, 20);this.chkHisttoryRoot.TabIndex = 0;this.chkHisttoryRoot.Tag = "2000";this.chkHisttoryRoot.Text = "历史模块";this.chkHisttoryRoot.UseVisualStyleBackColor = true;// // checkBox7// this.checkBox7.AutoSize = true;this.checkBox7.Location = new System.Drawing.Point(307, 14);this.checkBox7.Name = "checkBox7";this.checkBox7.Size = new System.Drawing.Size(90, 20);this.checkBox7.TabIndex = 0;this.checkBox7.Tag = "2003";this.checkBox7.Text = "系统日志";this.checkBox7.UseVisualStyleBackColor = true;// // chkWork// this.chkWork.AutoSize = true;this.chkWork.Location = new System.Drawing.Point(195, 14);this.chkWork.Name = "chkWork";this.chkWork.Size = new System.Drawing.Size(90, 20);this.chkWork.TabIndex = 0;this.chkWork.Tag = "2002";this.chkWork.Text = "工作日志";this.chkWork.UseVisualStyleBackColor = true;// // chkTask// this.chkTask.AutoSize = true;this.chkTask.Location = new System.Drawing.Point(99, 14);this.chkTask.Name = "chkTask";this.chkTask.Size = new System.Drawing.Size(90, 20);this.chkTask.TabIndex = 0;this.chkTask.Tag = "2001";this.chkTask.Text = "任务历史";this.chkTask.UseVisualStyleBackColor = true;// // checkBox13// this.checkBox13.AutoSize = true;this.checkBox13.Location = new System.Drawing.Point(195, 14);this.checkBox13.Name = "checkBox13";this.checkBox13.Size = new System.Drawing.Size(90, 20);this.checkBox13.TabIndex = 0;this.checkBox13.Tag = "4002";this.checkBox13.Text = "系统用户";this.checkBox13.UseVisualStyleBackColor = true;// // checkBox12// this.checkBox12.AutoSize = true;this.checkBox12.Location = new System.Drawing.Point(98, 14);this.checkBox12.Name = "checkBox12";this.checkBox12.Size = new System.Drawing.Size(90, 20);this.checkBox12.TabIndex = 0;this.checkBox12.Tag = "4001";this.checkBox12.Text = "角色权限";this.checkBox12.UseVisualStyleBackColor = true;// // checkBox9// this.checkBox9.AutoSize = true;this.checkBox9.Location = new System.Drawing.Point(99, 11);this.checkBox9.Name = "checkBox9";this.checkBox9.Size = new System.Drawing.Size(74, 20);this.checkBox9.TabIndex = 0;this.checkBox9.Tag = "3001";this.checkBox9.Text = "机器人";this.checkBox9.UseVisualStyleBackColor = true;// // checkBox10// this.checkBox10.AutoSize = true;this.checkBox10.Location = new System.Drawing.Point(195, 11);this.checkBox10.Name = "checkBox10";this.checkBox10.Size = new System.Drawing.Size(90, 20);this.checkBox10.TabIndex = 0;this.checkBox10.Tag = "3002";this.checkBox10.Text = "角色统计";this.checkBox10.UseVisualStyleBackColor = true;// // checkBox11// this.checkBox11.AutoSize = true;this.checkBox11.Location = new System.Drawing.Point(2, 14);this.checkBox11.Name = "checkBox11";this.checkBox11.Size = new System.Drawing.Size(90, 20);this.checkBox11.TabIndex = 0;this.checkBox11.Tag = "4000";this.checkBox11.Text = "配置模块";this.checkBox11.UseVisualStyleBackColor = true;// // panel1// this.panel1.Controls.Add(this.checkBox1);this.panel1.Controls.Add(this.checkBox2);this.panel1.Controls.Add(this.checkBox3);this.panel1.Location = new System.Drawing.Point(30, 13);this.panel1.Name = "panel1";this.panel1.Size = new System.Drawing.Size(309, 28);this.panel1.TabIndex = 1;// // checkBox1// this.checkBox1.AutoSize = true;this.checkBox1.Location = new System.Drawing.Point(3, 5);this.checkBox1.Name = "checkBox1";this.checkBox1.Size = new System.Drawing.Size(90, 20);this.checkBox1.TabIndex = 0;this.checkBox1.Tag = "1000";this.checkBox1.Text = "用户信息";this.checkBox1.ThreeState = true;this.checkBox1.UseVisualStyleBackColor = true;// // checkBox2// this.checkBox2.AutoSize = true;this.checkBox2.Location = new System.Drawing.Point(99, 5);this.checkBox2.Name = "checkBox2";this.checkBox2.Size = new System.Drawing.Size(90, 20);this.checkBox2.TabIndex = 0;this.checkBox2.Tag = "1001";this.checkBox2.Text = "实时角色";this.checkBox2.UseVisualStyleBackColor = true;// // checkBox3// this.checkBox3.AutoSize = true;this.checkBox3.Location = new System.Drawing.Point(195, 5);this.checkBox3.Name = "checkBox3";this.checkBox3.Size = new System.Drawing.Size(74, 20);this.checkBox3.TabIndex = 0;this.checkBox3.Tag = "1002";this.checkBox3.Text = "机器人";this.checkBox3.UseVisualStyleBackColor = true;// // checkBox8// this.checkBox8.AutoSize = true;this.checkBox8.Location = new System.Drawing.Point(3, 11);this.checkBox8.Name = "checkBox8";this.checkBox8.Size = new System.Drawing.Size(90, 20);this.checkBox8.TabIndex = 0;this.checkBox8.Tag = "3000";this.checkBox8.Text = "统计模块";this.checkBox8.UseVisualStyleBackColor = true;// // panel3// this.panel3.Controls.Add(this.checkBox8);this.panel3.Controls.Add(this.checkBox10);this.panel3.Controls.Add(this.checkBox9);this.panel3.Location = new System.Drawing.Point(30, 83);this.panel3.Name = "panel3";this.panel3.Size = new System.Drawing.Size(413, 34);this.panel3.TabIndex = 7;// // panel4// this.panel4.Controls.Add(this.checkBox11);this.panel4.Controls.Add(this.checkBox12);this.panel4.Controls.Add(this.checkBox13);this.panel4.Location = new System.Drawing.Point(30, 120);this.panel4.Name = "panel4";this.panel4.Size = new System.Drawing.Size(312, 45);this.panel4.TabIndex = 7;// // FEditRight// this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;this.ClientSize = new System.Drawing.Size(682, 375);this.Controls.Add(this.pnlMenu);this.Controls.Add(this.uiLabel3);this.Controls.Add(this.txtRoleDescription);this.Controls.Add(this.txtRoleName);this.Controls.Add(this.uiLabel2);this.Controls.Add(this.uiLabel1);this.Name = "FEditRight";this.Text = "FEditRight";this.ZoomScaleRect = new System.Drawing.Rectangle(15, -61, 800, 450);this.Load += new System.EventHandler(this.FEditRight_Load);this.Controls.SetChildIndex(this.pnlBtm, 0);this.Controls.SetChildIndex(this.uiLabel1, 0);this.Controls.SetChildIndex(this.uiLabel2, 0);this.Controls.SetChildIndex(this.txtRoleName, 0);this.Controls.SetChildIndex(this.txtRoleDescription, 0);this.Controls.SetChildIndex(this.uiLabel3, 0);this.Controls.SetChildIndex(this.pnlMenu, 0);this.pnlBtm.ResumeLayout(false);this.pnlMenu.ResumeLayout(false);this.panel2.ResumeLayout(false);this.panel2.PerformLayout();this.panel1.ResumeLayout(false);this.panel1.PerformLayout();this.panel3.ResumeLayout(false);this.panel3.PerformLayout();this.panel4.ResumeLayout(false);this.panel4.PerformLayout();this.ResumeLayout(false);}#endregionprivate Sunny.UI.UILabel uiLabel1;private Sunny.UI.UILabel uiLabel2;private Sunny.UI.UITextBox txtRoleName;private Sunny.UI.UITextBox txtRoleDescription;private Sunny.UI.UILabel uiLabel3;private System.Windows.Forms.Panel pnlMenu;private System.Windows.Forms.CheckBox checkBox10;private System.Windows.Forms.CheckBox checkBox3;private System.Windows.Forms.CheckBox checkBox8;private System.Windows.Forms.CheckBox chkTask;private System.Windows.Forms.CheckBox checkBox1;private System.Windows.Forms.CheckBox checkBox7;private System.Windows.Forms.CheckBox chkWork;private System.Windows.Forms.CheckBox checkBox13;private System.Windows.Forms.CheckBox checkBox12;private System.Windows.Forms.CheckBox checkBox9;private System.Windows.Forms.CheckBox checkBox11;private System.Windows.Forms.CheckBox chkHisttoryRoot;private System.Windows.Forms.CheckBox checkBox2;private System.Windows.Forms.Panel panel1;private System.Windows.Forms.Panel panel2;private System.Windows.Forms.Panel panel4;private System.Windows.Forms.Panel panel3;}
}

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/872359.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

昇思25天学习打卡营第13天|munger85

文本解码原理–以MindNLP为例 重要的就是怎么样把数字最后转化成真正的文字。而且自回归模型它会一个字给一个字的预测&#xff0c;下一个字应该是什么&#xff1f; 如果这个模型下载很慢&#xff0c;你就可以通过这种方式从摩大社区进行下载。 这种方式&#xff0c; 每一次候…

如何让LabVIEW程序框图的图标简化,从而节省空间?

再点击选项 取消掉箭头所示的√即可。 这样就可以将生成的图标从下面所示&#xff1a; 变成简化的图标&#xff0c;如下所示&#xff1a;

【Pytorch】数据集的加载和处理(一)

Pytorch torchvision 包提供了很多常用数据集 数据按照用途一般分为三组&#xff1a;训练&#xff08;train&#xff09;、验证&#xff08;validation&#xff09;和测试&#xff08;test&#xff09;。使用训练数据集来训练模型&#xff0c;使用验证数据集跟踪模型在训练期间…

安全防御拓扑1

目录 实验的拓扑&#xff1a; 要求&#xff1a; 我搭建的实验拓扑 步骤&#xff1a; 创建vlan&#xff1a; 接口配置&#xff1a; 防火墙&#xff1a; 防火墙配置&#xff1a; 建立安全策略&#xff1a; 防火墙的用户&#xff1a; 办公区的市场部和研发部用户 市场部…

杰发科技AC7801 —— __attribute__指定地址存储常量

const uint8_t usFlashInitVal[] __attribute__((at(0x08002800))) {0x55,0x55,0x55,0x55,0x55};//定位在flash中&#xff0c;0x00030000开始的6个字节信息固定 注意7801的地址在8000000之后 如地址选0x00000800烧录时候报错 不知道是不是atclinktool的bug&#xff0c;使用_…

勒索防御第一关 亚信安全AE防毒墙全面升级 勒索检出率提升150%

亚信安全信舷AE高性能防毒墙完成能力升级&#xff0c;全面完善勒索边界“全生命周期”防御体系&#xff0c;筑造边界勒索防御第一关&#xff01; 勒索之殇&#xff0c;银狐当先 当前勒索病毒卷携着AI技术&#xff0c;融合“数字化”的运营模式&#xff0c;形成了肆虐全球的网…

数据结构(4.4)——求next数组

next数组的作用:当模式串的第j个字符失配时&#xff0c;从模式串的第next[j]的继续往后匹配 求模式串的next数组(手算) next[1] 任何模式串都一样&#xff0c;第一个字符不匹配时&#xff0c;只能匹配下一个子串&#xff0c;因此&#xff0c;往后&#xff0c;next[1]都无脑写…

Classifier-Free Guidance (CFG) Scale in Stable Diffusion

1.Classifier-Free Guidance Scale in Stable Diffusion 笔记来源&#xff1a; 1.How does Stable Diffusion work? 2.Classifier-Free Diffusion Guidance 3.Guide to Stable Diffusion CFG scale (guidance scale) parameter 1.1 Classifier Guidance Scale 分类器引导是…

达梦数据库的系统视图v$dict_cache_item

达梦数据库的系统视图v$dict_cache_item 在达梦数据库&#xff08;DM Database&#xff09;中&#xff0c;V$DICT_CACHE_ITEM 是一个系统视图&#xff0c;用于显示字典缓存&#xff08;Dictionary Cache&#xff09;中的项信息。字典缓存是数据库中的一个重要组件&#xff0c;…

RepLKNet(CVPR 2022, MEGVII)

paper&#xff1a;Scaling Up Your Kernels to 31x31: Revisiting Large Kernel Design in CNNs official implementation&#xff1a;https://github.com/DingXiaoH/RepLKNet-pytorch 背景 卷积神经网络&#xff08;CNN&#xff09;曾经是现代计算机视觉系统中的常见选择。…

Golang | Leetcode Golang题解之第231题2的幂

题目&#xff1a; 题解&#xff1a; func isPowerOfTwo(n int) bool {const big 1 << 30return n > 0 && big%n 0 }

在 vite+vue3+electron 中使用 express

文章目录 一、Vite Vue3 Electron 项目的搭建二、搭建 express 环境1、安装 express 框架所需依赖2、创建 express 项目3、配置路由4、启动 express 服务5、启动 electron 并获取数据 三、项目打包 一、Vite Vue3 Electron 项目的搭建 详细的项目构建和打包可参考另一篇文…

hung 之 softlockup hardlockup 检测

1. softlockup & hardlockup 的含义 softlockup 指的是这样一种场景&#xff1a;由于内核程序设计问题&#xff0c;导致CPU长时间关闭抢占。 hardlockup 指的是这样一种场景&#xff1a;由于内核程序设计问题&#xff0c;导致CPU时钟中断长时间禁用。 softlockup 或 har…

【UE5.1】NPC人工智能——02 NPC移动到指定位置

效果 步骤 1. 新建一个蓝图&#xff0c;父类选择“AI控制器” 这里命名为“BP_NPC_AIController”&#xff0c;表示专门用于控制NPC的AI控制器 2. 找到我们之前创建的所有NPC的父类“BP_NPC” 打开“BP_NPC”&#xff0c;在类默认值中&#xff0c;将“AI控制器类”一项设置为“…

【Diffusion学习】【生成式AI】淺談圖像生成模型 Diffusion Model 原理

文章目录 Diffusion Model 是如何运作的&#xff1f;吃额外的1个数字&#xff1a;stepDenoise 模组内部实际做的事情&#xff1a;预测noise如何训练 Noise Predictor Text-to-ImageDDPM 算法 from&#xff1a; https://www.youtube.com/watch?vazBugJzmz-o&listPLJV_el3uV…

[HCTF 2018]WarmUp1

进入靶场&#xff0c;检查代码看到有source.php,访问 /source.php 读代码&#xff0c;在参数中传入 file&#xff0c;通过checkFile后&#xff0c;会加载file界面。 再看checkFile&#xff0c; 第一个判断&#xff0c;是非空并且是个字符串&#xff0c;否则返回false 第二个判…

微软研发致胜策略 01:尊定基础

这是一本老书&#xff0c;作者 Steve Maguire 在微软工作期间写了这本书&#xff0c;英文版于 1994 年发布。我们看到的标题是中译版名字&#xff0c;英文版的名字是《Debugging the Development Process》&#xff0c;这本书详细阐述了软件开发过程中的常见问题及其解决方案&a…

特征映射(机器学习)

有时数据的分类并不像我们想象的那么简单&#xff0c;需要高次曲线才能分类。 就像下面的数据&#xff1a; 数据集最后给出&#xff1a; 我们这样看&#xff0c;至少需要达到2次以及以上的曲线才可以进行比较准确的分类。 比如如果已知数据有3列(两列特征) x1x2y-1-110.50.…

Axolotl

文章目录 一、关于 Axolotl特点Axolotl支持 二、快速入门⚡用法 三、环境设置1、Docker2、Conda/Pip venv3、Cloud GPU4、Bare Metal Cloud GPULambdaLabsGCP 5、Windows6、Mac7、Google Colab8、通过SkyPilot在公共云上启动9、通过 dstack 在公共云上启动 四、其他高级设置1、…

网站成长时间轴页面,网站发展记录页源码

一、源码描述 这是一款网站时间轴HTML源码&#xff0c;样式设计精美并且使用简单&#xff0c;主要用于记录你的网站发展历程&#xff0c;或者可以用于发布心情动态等&#xff0c;左侧年份可以折叠起来&#xff0c;页面底部是导航区域&#xff0c;可以自定义文本和链接。 二、…