当前位置: 首页 > news >正文

c#:winform调用bartender实现打印(学习整理笔记)

效果

学习路径

C# winform调用Bartender进行自定义打印、批量打印、检索文件夹中的模板_哔哩哔哩_bilibili

一、初始环境搭建见:

c#:winform引入bartender-CSDN博客icon-default.png?t=O83Ahttps://blog.csdn.net/weixin_46001736/article/details/143989473?sharetype=blogdetail&sharerId=143989473&sharerefer=PC&sharesource=weixin_46001736&spm=1011.2480.3001.8118

二、创建bartender文件

1、创建两个文件test.btw,test2.btw,效果图

2、创建流程

文本->单行

①建立文本:姓名(普通文本)

直接输入标题便可

②建立文本:李四

点击名称,输入数据源

输入数据

其余建立文本方式与这个一致,目的是便于vs可操控bartender数据

③建立二维码内容

选择样式之后,左击鼠标展示到页面

双击二维码进行属性编辑

可见性设置为“无”:为了隐藏二维码下的文本

右击数据源->删除原有数据源123456

右击数据源->新建

选择已有或新建数据源

按照上述信息将姓名、性别、班级添加入二维码

3、将两个btw存入项目文件夹中

三、编写vs文件

1、修改App.config,避免不兼容问题

2、Form1.cs

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Seagull.BarTender.Print;
using static System.Windows.Forms.VisualStyles.VisualStyleElement;namespace test_bartender
{//这里的Form1继承自Formpublic partial class Form1 : Form{public Form1(){//来自分布类的方法-窗口展示InitializeComponent();}public Engine engine = new Engine();//定义一个打印机引擎public LabelFormatDocument format = null;//获取模板内容public static string path = Application.StartupPath + @"\Model";//模板路径(Application.StartupPath获取当前执行路径)public static DirectoryInfo direct = new DirectoryInfo(path);//实例化指定文件路径的目录public FileInfo[] fileInfo = direct.GetFiles();//获取指定路径上的所有文件public List<String> fileList = new List<string>();//所有模板文件数据(定义一个空列表)//加载模板文件名称至listBox控件public void loadList_Model() { //循环文件列表foreach(var item in fileInfo){//筛选出指定格式的文件(如果文件后缀为.BTW)if (item.Extension.ToUpper() == ".BTW"){fileList.Add(item.Name);//将文件的Name存入列表fileList}}//数据绑定,这里绑定了数据源到fileList之后就不能在对这个进行绑定,否则造成重复,所以后面模糊查询需要创建新的数据源listb_models.DataSource = fileList;}//执行打印//printmodel:模板名//printnum:数量//Sname:姓名//Sex:性别//Sclass:班级public void Pint_model(string printmodel, int printnum, string Sname, string Sex, string Sclass){for (int i = 0; i < printnum; i++){engine.Start();//开始打印btn_print.Enabled = false;//防止按钮重复点击,开始打印九设置打印为进制format = engine.Documents.Open(path + $"\\{printmodel}");//从路径path中的模板printmodel去打开文件if (Sname != ""){format.SubStrings["姓名"].Value = tb_name.Text;format.SubStrings["性别"].Value = tb_sex.Text;format.SubStrings["班级"].Value = tb_class.Text;}Result rel = format.Print();//获取打印状态if (rel == Result.Success){MessageBox.Show("打印成功!");}else{MessageBox.Show("打印失败!");}btn_print.Enabled = true;//启加载完成,启用按钮engine.Stop();//打印完成}}//窗口加载时使用private void Form1_Load(object sender, EventArgs e){loadList_Model();//启用加载模板}private void tb_model_TextChanged(object sender, EventArgs e){string searchTxt = tb_model.Text;//获取文本框输入的要查询的数据List<string> searchModel = new List<string>();//声明一个列表存放 查询出的文件名if (tb_model.Text.Trim().Length == 0)//如果查询框中的数据为空{//创建新的数据源:BindingSourceBindingSource bs = new BindingSource();bs.DataSource = fileList;//将查询的全部模板数据存入这个新的数据源listb_models.DataSource = bs;//将重新查到的全部模板数据又重新绑定给listb_models}else//有输入的数值,即需要模糊查询{for (int i = 0; i < fileList.Count; i++)//对全部模板数据进行循环{//查询我的全部模板数据的单项,查询这一项的是否包含searchTxt(输入的值)searchModel = fileList.Where(m => m.Contains(searchTxt)).ToList();//查询是否子项是否包含输入的值}BindingSource bs = new BindingSource();//新建数据源bs.DataSource = searchModel;//数据源 绑定含有输入的数据的项listb_models.DataSource = bs;//ListBox控件重新绑定数据}       }private void label4_Click(object sender, EventArgs e){}private void textBox5_TextChanged(object sender, EventArgs e){}private void textBox2_TextChanged(object sender, EventArgs e){}private void numericUpDown1_ValueChanged(object sender, EventArgs e){}//按钮点击事件private void btn_print_Click(object sender, EventArgs e){int num = (int) nup_num .Value;//获取打印数量string modelname;if (listb_models.SelectedIndex>=0) {modelname = listb_models.SelectedItem.ToString();//获取ListBox选中的模板Pint_model(modelname,num,tb_name.Text,tb_sex.Text,tb_class.Text);}else{MessageBox.Show("请选择模板");}}}继承举个例子现在有个Human类//public partial class Human//{//    public string Name {  get; set; }//    public int Age {  get; set; }//}现在有学生类Studentpublic partial class Student{//学生类也存在Name和Age属性public string Name { get; set; }public int Age { get; set; }//还有自己独有的一些属性public int score { get; set; }//由于Name和Age可以直接来自Hum,就可以替换成 public partial class Student:Human如下}//public partial class Student :Human//{//    //还有自己独有的一些属性//    public int score { get; set; }//    //通过继承Student除了自己独有的属性score,还含有Huam的全部属性//}}

3、Form1.cs设计页面

4、Form1.Designer.cs

namespace test_bartender
{//分部类,相同的命名空间下,会将相同的类合并,在Form1.cs可以看到也有一个类Form1,运行的时候,这里的类会合并到Form1.cs文件中partial class Form1{/// <summary>/// 必需的设计器变量。/// </summary>private System.ComponentModel.IContainer components = null;/// <summary>/// 清理所有正在使用的资源。/// </summary>/// <param name="disposing">如果应释放托管资源,为 true;否则为 false。</param>protected override void Dispose(bool disposing){if (disposing && (components != null)){components.Dispose();}base.Dispose(disposing);}#region Windows 窗体设计器生成的代码/// <summary>/// 设计器支持所需的方法 - 不要修改/// 使用代码编辑器修改此方法的内容。/// </summary>private void InitializeComponent(){this.listb_models = new System.Windows.Forms.ListBox();this.label1 = new System.Windows.Forms.Label();this.label2 = new System.Windows.Forms.Label();this.tb_model = new System.Windows.Forms.TextBox();this.label3 = new System.Windows.Forms.Label();this.tb_name = new System.Windows.Forms.TextBox();this.tb_class = new System.Windows.Forms.TextBox();this.label4 = new System.Windows.Forms.Label();this.tb_sex = new System.Windows.Forms.TextBox();this.label5 = new System.Windows.Forms.Label();this.label6 = new System.Windows.Forms.Label();this.backgroundWorker1 = new System.ComponentModel.BackgroundWorker();this.nup_num = new System.Windows.Forms.NumericUpDown();this.btn_print = new System.Windows.Forms.Button();((System.ComponentModel.ISupportInitialize)(this.nup_num)).BeginInit();this.SuspendLayout();// // listb_models:模板内容// this.listb_models.Cursor = System.Windows.Forms.Cursors.Hand;this.listb_models.FormattingEnabled = true;this.listb_models.ItemHeight = 15;this.listb_models.Location = new System.Drawing.Point(21, 111);this.listb_models.Name = "listb_models";this.listb_models.Size = new System.Drawing.Size(280, 244);this.listb_models.TabIndex = 3;// // label1-大标题// this.label1.AutoSize = true;this.label1.Font = new System.Drawing.Font("宋体", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label1.ForeColor = System.Drawing.SystemColors.ControlText;this.label1.Location = new System.Drawing.Point(183, 22);this.label1.Name = "label1";this.label1.Size = new System.Drawing.Size(269, 20);this.label1.TabIndex = 0;this.label1.Text = "Winform调用Bartender打印";// // label2-模板名标题// this.label2.AutoSize = true;this.label2.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label2.Location = new System.Drawing.Point(18, 80);this.label2.Name = "label2";this.label2.Size = new System.Drawing.Size(71, 15);this.label2.TabIndex = 1;this.label2.Text = "模板名:";// // tb_model:输入的模板名// this.tb_model.Location = new System.Drawing.Point(84, 77);this.tb_model.Name = "tb_model";this.tb_model.Size = new System.Drawing.Size(217, 25);this.tb_model.TabIndex = 2;this.tb_model.TextChanged += new System.EventHandler(this.tb_model_TextChanged);// // label3-姓名标题// this.label3.AutoSize = true;this.label3.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label3.Location = new System.Drawing.Point(372, 111);this.label3.Name = "label3";this.label3.Size = new System.Drawing.Size(55, 15);this.label3.TabIndex = 4;this.label3.Text = "姓名:";// // tb_name-姓名文本框// this.tb_name.BorderStyle = System.Windows.Forms.BorderStyle.None;this.tb_name.Location = new System.Drawing.Point(420, 108);this.tb_name.Name = "tb_name";this.tb_name.Size = new System.Drawing.Size(100, 18);this.tb_name.TabIndex = 5;this.tb_name.TextChanged += new System.EventHandler(this.textBox2_TextChanged);// // tb_class-班级文本框// this.tb_class.BorderStyle = System.Windows.Forms.BorderStyle.None;this.tb_class.Location = new System.Drawing.Point(420, 148);this.tb_class.Name = "tb_class";this.tb_class.Size = new System.Drawing.Size(100, 18);this.tb_class.TabIndex = 7;// // label4-班级标题// this.label4.AutoSize = true;this.label4.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label4.Location = new System.Drawing.Point(372, 151);this.label4.Name = "label4";this.label4.Size = new System.Drawing.Size(55, 15);this.label4.TabIndex = 6;this.label4.Text = "班级:";this.label4.Click += new System.EventHandler(this.label4_Click);// // tb_sex-性别标题// this.tb_sex.BorderStyle = System.Windows.Forms.BorderStyle.None;this.tb_sex.Location = new System.Drawing.Point(420, 188);this.tb_sex.Name = "tb_sex";this.tb_sex.Size = new System.Drawing.Size(100, 18);this.tb_sex.TabIndex = 9;// // label5-性别标题// this.label5.AutoSize = true;this.label5.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label5.Location = new System.Drawing.Point(372, 191);this.label5.Name = "label5";this.label5.Size = new System.Drawing.Size(55, 15);this.label5.TabIndex = 8;this.label5.Text = "性别:";// // label6-数量标题// this.label6.AutoSize = true;this.label6.Font = new System.Drawing.Font("宋体", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(134)));this.label6.Location = new System.Drawing.Point(372, 260);this.label6.Name = "label6";this.label6.Size = new System.Drawing.Size(55, 15);this.label6.TabIndex = 10;this.label6.Text = "数量:";// // nup_num-数量文本框// this.nup_num.Location = new System.Drawing.Point(420, 250);this.nup_num.Name = "nup_num";this.nup_num.Size = new System.Drawing.Size(100, 25);this.nup_num.TabIndex = 11;this.nup_num.ValueChanged += new System.EventHandler(this.numericUpDown1_ValueChanged);// // btn_print-打印按钮// this.btn_print.BackColor = System.Drawing.SystemColors.ActiveCaption;this.btn_print.Font = new System.Drawing.Font("宋体", 10F);this.btn_print.ForeColor = System.Drawing.SystemColors.ButtonHighlight;this.btn_print.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;this.btn_print.Location = new System.Drawing.Point(375, 316);this.btn_print.Name = "btn_print";this.btn_print.Size = new System.Drawing.Size(150, 30);this.btn_print.TabIndex = 12;this.btn_print.Text = "打印";this.btn_print.UseVisualStyleBackColor = false;this.btn_print.Click += new System.EventHandler(this.btn_print_Click);// // Form1-窗口// this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;this.ClientSize = new System.Drawing.Size(635, 387);this.Controls.Add(this.btn_print);this.Controls.Add(this.nup_num);this.Controls.Add(this.label6);this.Controls.Add(this.tb_sex);this.Controls.Add(this.label5);this.Controls.Add(this.tb_class);this.Controls.Add(this.label4);this.Controls.Add(this.tb_name);this.Controls.Add(this.label3);this.Controls.Add(this.listb_models);this.Controls.Add(this.tb_model);this.Controls.Add(this.label2);this.Controls.Add(this.label1);this.Name = "Form1";this.Text = "窗口";this.Load += new System.EventHandler(this.Form1_Load);((System.ComponentModel.ISupportInitialize)(this.nup_num)).EndInit();this.ResumeLayout(false);this.PerformLayout();}#endregionprivate System.Windows.Forms.Label label1;private System.Windows.Forms.Label label2;private System.Windows.Forms.TextBox tb_model;private System.Windows.Forms.Label label3;private System.Windows.Forms.TextBox tb_name;private System.Windows.Forms.TextBox tb_class;private System.Windows.Forms.Label label4;private System.Windows.Forms.TextBox tb_sex;private System.Windows.Forms.Label label5;private System.Windows.Forms.Label label6;private System.Windows.Forms.ListBox listb_models; private System.ComponentModel.BackgroundWorker backgroundWorker1;private System.Windows.Forms.NumericUpDown nup_num;private System.Windows.Forms.Button btn_print;}
}

四、运行

相关文章:

c#:winform调用bartender实现打印(学习整理笔记)

效果 学习路径 C# winform调用Bartender进行自定义打印、批量打印、检索文件夹中的模板_哔哩哔哩_bilibili 一、初始环境搭建见&#xff1a; c#:winform引入bartender-CSDN博客https://blog.csdn.net/weixin_46001736/article/details/143989473?sharetypeblogdetail&s…...

牛客题库 21738 牛牛与数组

牛牛与数组题目链接 题目大意 牛牛喜欢这样的数组: 1:长度为n 2:每一个数都在1到k之间 3:对于任意连续的两个数A,B,A<=B 与(A % B != 0) 两个条件至少成立一个请问一共有多少满足条件的数组,对 1 e 9 + 7 1e^9+7 1e9+7 取模 输入格式 输入两个整数 n , k n,k n,…...

探索PDFMiner:Python中的PDF解析利器

文章目录 **探索PDFMiner&#xff1a;Python中的PDF解析利器**1. 背景介绍&#xff1a;为何选择PDFMiner&#xff1f;2. PDFMiner是什么&#xff1f;3. 如何安装PDFMiner&#xff1f;4. 简单库函数使用方法4.1 提取文本4.2 获取页面布局信息4.3 提取表格数据4.4 提取图像 5. 应…...

掌握Go语言中的异常控制:panic、recover和defer的深度解析

掌握Go语言中的异常控制:panic、recover和defer的深度解析 在Go语言的编程世界中,异常处理是一个不可忽视的话题。Go语言提供了panic、recover和defer三个关键字来处理程序中的异常情况。本文将深入探讨这三个关键字的工作原理、使用场景和最佳实践,帮助读者在实际编程中更…...

云讷科技Kerloud无人飞车专利发布

云讷科技Kerloud无人飞车获得了“一种室内外两用的四旋翼无人飞车”的实用新型专利证书&#xff0c;作为科教社区第一款四旋翼飞车&#xff0c;这项技术结合了无人机和无人车的优势&#xff0c;提供了一种能够在多种环境下使用的多功能飞行器。 这项设计的优势如下&#xff…...

企业信息化-走进身份管理之搭建篇

​一、身份管理是什么 我们先要弄懂统一身份管理到底是什么&#xff1f; 统一身份管理&#xff08;Unified Identity Manager&#xff0c;UIM&#xff09;&#xff0c;身份管理&#xff08;Identity Management&#xff0c;简称IDM&#xff09;&#xff0c;也被称为IAM&#…...

实践指南:EdgeOne与HAI的梦幻联动

在当今快速发展的数字时代&#xff0c;安全和速度已成为网络服务的基石。EdgeOne&#xff0c;作为腾讯云提供的边缘安全加速平台&#xff0c;以其全球部署的节点和强大的安全防护功能&#xff0c;为用户提供了稳定而高效的网络体验。而HAI&#xff08;HyperApplicationInventor…...

Exploring Prompt Engineering: A Systematic Review with SWOT Analysis

文章目录 题目摘要简介方法论背景相关工作评估结论 题目 探索快速工程&#xff1a;基于 SWOT 分析的系统评价 论文地址&#xff1a; https://arxiv.org/abs/2410.12843 摘要 在本文中&#xff0c;我们对大型语言模型 (LLM) 领域的提示工程技术进行了全面的 SWOT 分析。我们强…...

ByteBuffer 与 ByteBuf 的对比与优缺点分析

在 Java 网络编程和高性能 I/O 场景中&#xff0c;ByteBuffer 和 ByteBuf 是两种重要的缓冲区处理工具。ByteBuffer 是 Java NIO 标准库的一部分&#xff0c;而 ByteBuf 是由 Netty 框架提供的增强缓冲区工具。在实际开发中&#xff0c;选择哪一种取决于场景需求和性能目标。 …...

js高级06-ajax封装和跨域

8.1、ajax简介及相关知识 8.1.1、原生ajax 8.1.1.1、AJAX 简介 AJAX 全称为 Asynchronous JavaScript And XML&#xff0c;就是异步的 JS 和 XML。 通过 AJAX 可以在浏览器中向服务器发送异步请求&#xff0c;最大的优势&#xff1a;无刷新获取数据。 按需请求&#xff0c;可…...

RabbitMQ3:Java客户端快速入门

欢迎来到“雪碧聊技术”CSDN博客&#xff01; 在这里&#xff0c;您将踏入一个专注于Java开发技术的知识殿堂。无论您是Java编程的初学者&#xff0c;还是具有一定经验的开发者&#xff0c;相信我的博客都能为您提供宝贵的学习资源和实用技巧。作为您的技术向导&#xff0c;我将…...

D 型 GaN HEMT 在功率转换方面的优势

氮化镓 (GaN) 是一种 III-V 族宽带隙半导体&#xff0c;由于在用作横向高电子迁移率晶体管 (HEMT) 时具有卓越的材料和器件性能&#xff0c;因此在功率转换应用中得到越来越多的采用。 HEMT 中产生的高击穿电场 (3.3 MV/cm) 和高二维电子气 (2DEG) 载流子迁移率 (2,000 cm 2 /…...

Java Web后端项目的特点和组成部分

技术栈 #### Java Web技术&#xff1a; - **Servlet**&#xff1a;Java Web的核心&#xff0c;用于处理HTTP请求。 - **WebServlet注解配置**&#xff1a;用于简化Servlet的配置。 - **HttpServlet基类**&#xff1a;大多数Servlet都继承自此基类。 - **请求响应处理**&#x…...

Vue3 + Vite + TS 项目引入 Eslint + Pritter

文章目录 一、ESLint 简介主要功能适用场景常用的 Eslint 配置项 二、Pritter 简介主要功能适用场景常用的 Prettier 配置项 三、Vue3 Vite TS 项目引入 Eslint Pritter1. 安装 ESLint2. 初始化 ESLint 配置3. 在 Vite 项目中启用 ESLint4. 在 VS Code 中启用 ESLint5. 集成…...

用Tauri框架构建跨平台桌面应用:1、Tauri快速开始

Tauri 是一个构建适用于所有主流桌面和移动平台的轻快二进制文件的框架。开发者们可以集成任何用于创建用户界面的可以被编译成 HTML、JavaScript 和 CSS 的前端框架&#xff0c;同时可以在必要时使用 Rust、Swift 和 Kotlin 等语言编写后端逻辑。 Tauri 是什么&#xff1f; |…...

Django实现智能问答助手-数据库方式读取问题和答案

扩展 增加问答数据库&#xff0c;通过 Django Admin 添加问题和答案。实现更复杂的问答逻辑&#xff0c;比如使用自然语言处理&#xff08;NLP&#xff09;库。使用前端框架&#xff08;如 Bootstrap&#xff09;增强用户界面 1.注册模型到 Django Admin&#xff08;admin.py…...

stm32利用LED配置基础寄存器+体验滴答定时器+hal库环境配置

P1 LED控制与流水灯效果实现 概述 大家好&#xff0c;今天我们来学习一下如何在STM32上控制LED灯&#xff0c;并且实现一个流水灯的效果。这不仅是一个基础的实践&#xff0c;也是嵌入式开发中非常常见的需求。 LED控制 1. LED初始化 首先&#xff0c;我们需要对LED灯对应…...

JAVA开源项目 桂林旅游景点导游平台 计算机毕业设计

博主说明&#xff1a;本文项目编号 T 079 &#xff0c;文末自助获取源码 \color{red}{T079&#xff0c;文末自助获取源码} T079&#xff0c;文末自助获取源码 目录 一、系统介绍二、演示录屏三、启动教程四、功能截图五、文案资料5.1 选题背景5.2 国内外研究现状5.3 可行性分析…...

docker安装使用Elasticsearch,解决启动后无法访问9200问题

1.docker安装、启动es docker pull elasticsearch:8.13.0docker images启动容器 docker run -d -p 9200:9200 -p 9300:9300 -e ES_JAVA_OPTS"-Xms256m -Xmx256m" --name es01 8ebd258614f1-d 后台运行-p 9200:9200 -p 9300:9300 开放与主机映射端口-e ES_JAVA_OPTS…...

GM、BP、LSTM时间预测预测代码

GM clc; clear; close all;%% 数据加载和预处理 [file, path] uigetfile(*.xlsx, Select the Excel file); filename fullfile(path, file); time_series xlsread(filename);% 确保数据是一列 time_series time_series(:);% 归一化数据 min_val min(time_series); max_v…...

黑马Mybatis

Mybatis 表现层&#xff1a;页面展示 业务层&#xff1a;逻辑处理 持久层&#xff1a;持久数据化保存 在这里插入图片描述 Mybatis快速入门 ![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/6501c2109c4442118ceb6014725e48e4.png //logback.xml <?xml ver…...

html-<abbr> 缩写或首字母缩略词

定义与作用 <abbr> 标签用于表示缩写或首字母缩略词&#xff0c;它可以帮助用户更好地理解缩写的含义&#xff0c;尤其是对于那些不熟悉该缩写的用户。 title 属性的内容提供了缩写的详细说明。当用户将鼠标悬停在缩写上时&#xff0c;会显示一个提示框。 示例&#x…...

【生成模型】视频生成论文调研

工作清单 上游应用方向&#xff1a;控制、速度、时长、高动态、多主体驱动 类型工作基础模型WAN / WAN-VACE / HunyuanVideo控制条件轨迹控制ATI~镜头控制ReCamMaster~多主体驱动Phantom~音频驱动Let Them Talk: Audio-Driven Multi-Person Conversational Video Generation速…...

佰力博科技与您探讨热释电测量的几种方法

热释电的测量主要涉及热释电系数的测定&#xff0c;这是表征热释电材料性能的重要参数。热释电系数的测量方法主要包括静态法、动态法和积分电荷法。其中&#xff0c;积分电荷法最为常用&#xff0c;其原理是通过测量在电容器上积累的热释电电荷&#xff0c;从而确定热释电系数…...

Go 并发编程基础:通道(Channel)的使用

在 Go 中&#xff0c;Channel 是 Goroutine 之间通信的核心机制。它提供了一个线程安全的通信方式&#xff0c;用于在多个 Goroutine 之间传递数据&#xff0c;从而实现高效的并发编程。 本章将介绍 Channel 的基本概念、用法、缓冲、关闭机制以及 select 的使用。 一、Channel…...

STM32---外部32.768K晶振(LSE)无法起振问题

晶振是否起振主要就检查两个1、晶振与MCU是否兼容&#xff1b;2、晶振的负载电容是否匹配 目录 一、判断晶振与MCU是否兼容 二、判断负载电容是否匹配 1. 晶振负载电容&#xff08;CL&#xff09;与匹配电容&#xff08;CL1、CL2&#xff09;的关系 2. 如何选择 CL1 和 CL…...

密码学基础——SM4算法

博客主页&#xff1a;christine-rr-CSDN博客 ​​​​专栏主页&#xff1a;密码学 &#x1f4cc; 【今日更新】&#x1f4cc; 对称密码算法——SM4 目录 一、国密SM系列算法概述 二、SM4算法 2.1算法背景 2.2算法特点 2.3 基本部件 2.3.1 S盒 2.3.2 非线性变换 ​编辑…...

海云安高敏捷信创白盒SCAP入选《中国网络安全细分领域产品名录》

近日&#xff0c;嘶吼安全产业研究院发布《中国网络安全细分领域产品名录》&#xff0c;海云安高敏捷信创白盒&#xff08;SCAP&#xff09;成功入选软件供应链安全领域产品名录。 在数字化转型加速的今天&#xff0c;网络安全已成为企业生存与发展的核心基石&#xff0c;为了解…...

WEB3全栈开发——面试专业技能点P4数据库

一、mysql2 原生驱动及其连接机制 概念介绍 mysql2 是 Node.js 环境中广泛使用的 MySQL 客户端库&#xff0c;基于 mysql 库改进而来&#xff0c;具有更好的性能、Promise 支持、流式查询、二进制数据处理能力等。 主要特点&#xff1a; 支持 Promise / async-await&#xf…...

Git 命令全流程总结

以下是从初始化到版本控制、查看记录、撤回操作的 Git 命令全流程总结&#xff0c;按操作场景分类整理&#xff1a; 一、初始化与基础操作 操作命令初始化仓库git init添加所有文件到暂存区git add .提交到本地仓库git commit -m "提交描述"首次提交需配置身份git c…...