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

C#标签设计打印软件开发

1、新建自定义C#控件项目Custom

using System;
using System.Collections.Generic;
using System.Text;namespace CustomControls
{public class CommonSettings{/// <summary>/// 把像素换算成毫米/// </summary>/// <param name="Pixel">多少像素</param>/// <returns>多少毫米</returns>public static float PixelConvertMillimeter(float Pixel){return Pixel / 96 * 25.4f;}/// <summary>/// 把毫米换算成像素/// </summary>/// <param name="Millimeter">多少毫米</param>/// <returns>多少像素</returns>public static int MillimeterConvertPixel(float Millimeter){return ((int)(Millimeter / 25.4 * 96)+1);}}
}

GraphicsTools 

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing.Drawing2D;
using System.Drawing;namespace CustomControls
{internal static class GraphicsTools{/// <summary>/// Creates a rounded rectangle from the specified rectangle and radius/// </summary>/// <param name="rectangle">Base rectangle</param>/// <param name="radius">Radius of the corners</param>/// <returns>Rounded rectangle as a GraphicsPath</returns>public static GraphicsPath CreateRoundRectangle(Rectangle rectangle, int radius){GraphicsPath path = new GraphicsPath();int l = rectangle.Left;int t = rectangle.Top;int w = rectangle.Width;int h = rectangle.Height;int d = radius << 1;path.AddArc(l, t, d, d, 180, 90); // topleftpath.AddLine(l + radius, t, l + w - radius, t); // toppath.AddArc(l + w - d, t, d, d, 270, 90); // toprightpath.AddLine(l + w, t + radius, l + w, t + h - radius); // rightpath.AddArc(l + w - d, t + h - d, d, d, 0, 90); // bottomrightpath.AddLine(l + w - radius, t + h, l + radius, t + h); // bottompath.AddArc(l, t + h - d, d, d, 90, 90); // bottomleftpath.AddLine(l, t + h - radius, l, t + radius); // leftpath.CloseFigure();return path;}/// <summary>/// Creates a rectangle rounded on the top/// </summary>/// <param name="rectangle">Base rectangle</param>/// <param name="radius">Radius of the top corners</param>/// <returns>Rounded rectangle (on top) as a GraphicsPath object</returns>public static GraphicsPath CreateTopRoundRectangle(Rectangle rectangle, int radius){GraphicsPath path = new GraphicsPath();int l = rectangle.Left;int t = rectangle.Top;int w = rectangle.Width;int h = rectangle.Height;int d = radius << 1;path.AddArc(l, t, d, d, 180, 90); // topleftpath.AddLine(l + radius, t, l + w - radius, t); // toppath.AddArc(l + w - d, t, d, d, 270, 90); // toprightpath.AddLine(l + w, t + radius, l + w, t + h); // rightpath.AddLine(l + w, t + h, l, t + h); // bottompath.AddLine(l, t + h, l, t + radius); // leftpath.CloseFigure();return path;}/// <summary>/// Creates a rectangle rounded on the bottom/// </summary>/// <param name="rectangle">Base rectangle</param>/// <param name="radius">Radius of the bottom corners</param>/// <returns>Rounded rectangle (on bottom) as a GraphicsPath object</returns>public static GraphicsPath CreateBottomRoundRectangle(Rectangle rectangle, int radius){GraphicsPath path = new GraphicsPath();int l = rectangle.Left;int t = rectangle.Top;int w = rectangle.Width;int h = rectangle.Height;int d = radius << 1;path.AddLine(l + radius, t, l + w - radius, t); // toppath.AddLine(l + w, t + radius, l + w, t + h - radius); // rightpath.AddArc(l + w - d, t + h - d, d, d, 0, 90); // bottomrightpath.AddLine(l + w - radius, t + h, l + radius, t + h); // bottompath.AddArc(l, t + h - d, d, d, 90, 90); // bottomleftpath.AddLine(l, t + h - radius, l, t + radius); // leftpath.CloseFigure();return path;}}
}

2、打印机设置界面

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing.Printing;
using System.Text;
using System.Windows.Forms;
using  CustomControls.IO;namespace CustomControls.Control
{public partial class frmSetting : Form{public frmSetting(PrintConfig confg){InitializeComponent();pconfig = confg;}private PrintConfig pconfig;private void frmSetting_Load(object sender, EventArgs e){for (int i=0; i < PrinterSettings.InstalledPrinters.Count; i++){cbPrintName.Items.Add(PrinterSettings.InstalledPrinters[i]);}if (cbPrintName.Items.Count > 0){cbPrintName.SelectedItem = pconfig.PrintName;}numX.Value = pconfig.XOFFSET;numY.Value = pconfig.YOFFSET;numZoom.Value = (decimal)pconfig.ZOOM;numCopies.Value = pconfig.Copies;}private void btnClose_Click(object sender, EventArgs e){this.Close();}private void btnOk_Click(object sender, EventArgs e){pconfig.XOFFSET = (int)numX.Value;pconfig.YOFFSET = (int)numY.Value;pconfig.PrintName = cbPrintName.SelectedItem.ToString();pconfig.ZOOM = (float)numZoom.Value;pconfig.Copies = (int)numCopies.Value;this.Close();}}
}

 3、条形码39码\93码实现

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Drawing.Drawing2D;
namespace CustomControls.BarCode
{[Serializable]internal class Code39 : IBarcode{public Code39(){EncodeBarcodeValue();}#region Variable/// <summary>/// 是否显示条码的值/// </summary>private bool bShowText = true;/// <summary>/// 是否在条码上方显示字符/// </summary>private bool bShowTextOnTop = false;/// <summary>/// 条码值的对值的对齐方式/// </summary>private BarcodeTextAlign align = BarcodeTextAlign.Left;/// <summary>/// 条码的做图区域/// </summary>private Rectangle barcodeRect;/// <summary>/// 条码的值/// </summary>private String code = "0123456";/// <summary>/// 条码的高度/// </summary>private int height = 30;/// <summary>/// 条码的大小/// </summary>private BarCodeWeight weight = BarCodeWeight.Small;/// <summary>/// 旋转/// </summary>private BarcodeRotation Rotation = BarcodeRotation.Rotation90;/// <summary>/// 条码的字体/// </summary>private Font textFont = new Font("Courier", 8);/// <summary>/// 将条码数据编码/// </summary>private String encodedString = "";/// <summary>

相关文章:

C#标签设计打印软件开发

1、新建自定义C#控件项目Custom using System; using System.Collections.Generic; using System.Text;namespace CustomControls {public class CommonSettings{/// <summary>/// 把像素换算成毫米/// </summary>/// <param name="Pixel">多少像素…...

Springboot+vue+小程序+基于微信小程序的在线学习平台

一、项目介绍    基于Spring BootVue小程序的在线学习平台从实际情况出发&#xff0c;结合当前年轻人的学习环境喜好来开发。基于Spring BootVue小程序的在线学习平台在语言上使用Java语言进行开发&#xff0c;在数据库存储方面使用的MySQL数据库&#xff0c;开发工具是IDEA。…...

正点原子[第二期]Linux之ARM(MX6U)裸机篇学习笔记-13-按键实验

前言&#xff1a; 本文是根据哔哩哔哩网站上“正点原子[第二期]Linux之ARM&#xff08;MX6U&#xff09;裸机篇”视频的学习笔记&#xff0c;在这里会记录下正点原子 I.MX6ULL 开发板的配套视频教程所作的实验和学习笔记内容。本文大量引用了正点原子教学视频和链接中的内容。…...

ubuntu与redhat的不同之处

华子目录 什么是ubuntu概述 ubuntu版本简介桌面版服务器版 安装部署部署后的设置设置root密码关闭防火墙启用允许root进行ssh登录更改apt源安装所需软件 安装nginx安装apache网络配置Netplan概述配置详解配置文件DHCP静态IP设置设置 软件安装方法apt安装软件作用常用命令配置ap…...

三岁孩童被家养大型犬咬伤 额部撕脱伤达10公分

近期&#xff0c;一名被家养大型犬咬伤了面部的3岁小朋友&#xff0c;在被家人紧急送来西安国际医学中心医院&#xff0c;通过24小时急诊门诊简单救治后&#xff0c;转至整形外科&#xff0c;由主治医师李世龙为他实施了清创及缝合手术。 “患者额部撕脱伤面积约为10公分&…...

@click=“handleClick()“不会传递默认事件参数

当你使用click"handleClick()"这种形式绑定事件处理器时&#xff0c;Vue会将它视为一个函数调用&#xff0c;而不是一个事件监听器。在这种情况下&#xff0c;Vue不会自动传递原生事件对象作为默认参数。 如果你想让Vue自动传递原生事件对象作为默认参数&#xff0c…...

KVM安装Ubuntu24.04简要坑点以及优点

本机环境是ubuntu22.04的环境&#xff0c;然后是8核16线程 ssd是500的 目前对于虚拟机的选择&#xff0c;感觉kvm确实会更加流畅&#xff0c;最重要的一点是简洁&#xff0c;然后实际安装效果也比较的好&#xff0c;如果对于速度方面希望快一点&#xff0c;并且流畅一点的话这…...

QT_day1

#include "mywidget.h"MyWidget::MyWidget(QWidget *parent): QWidget(parent) {//修改窗口标题this->setWindowTitle("4.6.0");//修改窗口图标this->setWindowIcon(QIcon("C:\\Users\\zj\\Desktop\\yuanshen\\icon"));//修改窗口大小this…...

AWS宣布推出Amazon Q :针对商业数据和软件开发的生成性AI助手

亚马逊网络服务&#xff08;AWS&#xff09;近日宣布推出了一项名为“Amazon Q”的新服务&#xff0c;旨在帮助企业利用生成性人工智能&#xff08;AI&#xff09;技术&#xff0c;优化工作流程和提升业务效率。这一创新平台的推出&#xff0c;标志着企业工作方式的又一次重大变…...

C++:多继承虚继承

在C中&#xff0c;虚继承&#xff08;Virtual Inheritance&#xff09;是一种特殊的继承方式&#xff0c;用于解决菱形继承&#xff08;Diamond Inheritance&#xff09;问题。菱形继承指的是一个类同时继承自两个或更多个具有共同基类的类&#xff0c;从而导致了多个实例同一个…...

Linux进程间通信

每个进程的用户空间都是独立的&#xff0c;不能相互访问。 所有进程的内核空间(32位系统3G-4G)都是共享的 应用场景 作为缓冲区&#xff0c;处理速度不同的进程之间的数据传输资源共享&#xff1a;多个进程之间共享同样的资源&#xff0c;一个进程对共享数据的修改&#xff0c…...

【二叉树算法题记录】222. 完全二叉树的节点个数

题目描述 给你一棵 完全二叉树 的根节点root &#xff0c;求出该树的节点个数。 完全二叉树的定义如下&#xff1a;在完全二叉树中&#xff0c;除了最底层节点可能没填满外&#xff0c;其余每层节点数都达到最大值&#xff0c;并且最下面一层的节点都集中在该层最左边的若干位…...

每日新闻掌握【2024年5月6日 星期一】

2024年5月06日 星期一 农历三月廿八 大公司/大事件 多个品牌黄金优惠后价格重回600元/克以下 “五一”假期期间&#xff0c;记者走访调研黄金消费市场发现&#xff0c;受国际金价回落及“五一”假期促销等多重因素影响&#xff0c;终端黄金价格出现了较为明显的回落。包括周大…...

谈谈Tcpserver开启多线程并发处理遇到的问题!

最近在学习最基础的socket网络编程&#xff0c;在Tcpserver开启多线程并发处理时遇到了一些问题&#xff01; 说明 在linux以及Windows的共享文件夹进行编写的&#xff0c;所以代码中有的部分使用 #ifdef WIN64 ... #else ... #endif 进入正题&#xff01;&#xff01;&…...

618好物节不知道买什么?快收下这份好物推荐指南!

随着618好物节的临近&#xff0c;你是否在为选择什么产品而犹豫不决&#xff1f;不用担忧&#xff0c;我精心准备了一份购物指南&#xff0c;旨在帮助你发现那些性价比高、口碑爆棚的商品。无论是科技新品还是生活小物件&#xff0c;这份指南都能帮你快速定位到那些值得投资的好…...

Django高级表单处理与验证实战

title: Django高级表单处理与验证实战 date: 2024/5/6 20:47:15 updated: 2024/5/6 20:47:15 categories: 后端开发 tags: Django表单验证逻辑模板渲染安全措施表单测试重定向管理最佳实践 引言&#xff1a; 在Web应用开发中&#xff0c;表单是用户与应用之间进行交互的重要…...

类和对象-Python-第一部分

初识对象 使用对象组织数据 class Student:nameNonegenderNonenationalityNonenative_placeNoneageNonestu_1Student()stu_1.name"林军杰" stu_1.gender"男" stu_1.nationality"中国" stu_1.native_place"山东" stu_1.age31print(stu…...

Pytorch实现图片异常检测

图片异常检测 异常检测指的是在正常的图片中找到异常的数据&#xff0c;由于无法通过规则进行识别判断&#xff0c;这样的应用场景通常都是需要人工进行识别&#xff0c;比如残次品的识别&#xff0c;图片异常识别模型的目标是可以代替或者辅助人工进行识别异常图片。 AnoGAN…...

【NOI-题解】1586. 扫地机器人1430 - 迷宫出口1434. 数池塘(四方向)1435. 数池塘(八方向)

文章目录 一、前言二、问题问题&#xff1a;1586 - 扫地机器人问题&#xff1a;1430 - 迷宫出口问题&#xff1a;1434. 数池塘&#xff08;四方向&#xff09;问题&#xff1a;1435. 数池塘&#xff08;八方向&#xff09; 三、感谢 一、前言 本章节主要对深搜基础题目进行讲解…...

探究MySQL行格式:解析DYNAMIC与COMPACT的异同

在MySQL中&#xff0c;行格式对于数据存储和检索起着至关重要的作用。MySQL提供了多种行格式&#xff0c;其中DYNAMIC和COMPACT是两种常见的行格式。 本文将深入探讨MySQL行格式DYNAMIC和COMPACT的区别&#xff0c;帮助读者更好地理解它们的特点和适用场景。 1. MySQL行格式简…...

MATLAB绘制蒸汽压力和温度曲线

蒸汽压力与温度之间的具体关系公式一般采用安托因方程&#xff08;Antoine Equation&#xff09;&#xff0c;用于描述纯物质的蒸汽压与温度之间的关系。安托因方程的一般形式如下&#xff1a; [\log_{10} P A - \frac{B}{C T}] 其中&#xff0c; (P) 是蒸汽压&#xff08…...

repo跟git的关系

关于repo 大都讲的太复杂了,大多是从定义角度跟命令角度去讲解,其实从现实项目使用角度而言repo很好理解. 我们都知道git是用来管理项目的,多人开发过程中git功能很好用.现在我们知道一个项目会用一个git仓库去管理,项目的开发过程中会使用git创建分支之类的来更好的维护项目代…...

Mysql 8.0 -- 最新版本安装(保姆级教程)

Mysql 8.0 -- 最新版本安装&#xff08;保姆级教程&#xff09; ​​ 一&#xff0c;下载Mysql数据库&#xff1a; 官网链接&#xff1a;https://www.mysql.com/downloads/ 二&#xff0c;安装Mysql: 三&#xff0c;找到Mysql安装目录&#xff1a; 找到mysql安装目录&#xf…...

sql优化思路

sql的优化经验 这里解释一下SQL语句的优化的原理 1.指明字段名称&#xff0c;可以尽量使用覆盖索引&#xff0c;避免回表查询&#xff0c;因此可以提高效率 2.字面意思&#xff0c;无需过多赘述。索引就是为了提高查询效率的。 3.图中两条sql直接可以使用union all 或者 uni…...

gin学习1-7

package mainimport ("github.com/gin-gonic/gin""net/http" )// 响应json还有其他响应差不多可以去学 func _string(c *gin.Context) {c.String(http.StatusOK, "lalal") } func _json(c *gin.Context) {//json响应结构体type UsetInfo struct …...

likeshop多商户单商户商城_likeshop跑腿源码_likeshop物品租赁系统开源版怎么配置小程序对接?

本人是商业用户所以能持续得到最新商业版&#xff0c;今天我说下likeshop里面怎么打包小程序&#xff0c;大家得到程序时候会发现它有admin目录 app目录 server目录 这三个目录分别是做什么呢&#xff1f; 1.admin目录 下面都是架构文件使用得是Node.js打包得&#xff0c;至于…...

(done) LSTM 详解 (包括它为什么能缓解梯度消失)

RNN 参考视频&#xff1a;https://www.bilibili.com/video/BV1e5411K7oW/?p2&spm_id_frompageDriver&vd_source7a1a0bc74158c6993c7355c5490fc600 LSTM 参考视频&#xff1a;https://www.bilibili.com/video/BV1qM4y1M7Nv?p5&vd_source7a1a0bc74158c6993c7355c5…...

springboot使用研究

map-underscore-to-camel-case: true 开启驼峰命名 GetMapping("/userInfo")public Result<Users> userInfo(RequestHeader(name "Authorization") String token,HttpServletResponse response) {Map<String, Object> map JwtUtil.parseT…...

老旧房屋用电线路故障引起的电气火灾预防对策​

摘 要&#xff1a;在我国新农村建设方针指引下&#xff0c;农村地区的发展水平有了显著提高。在农村经济发展中&#xff0c;我们也要认识到其中存在的风险隐患问题&#xff0c;其中重要的就是火灾事故。火灾事故给农村发展带来的不利影响&#xff0c;不仅严重威胁到农村群众的生…...

OpenAI发布GPT-4.0使用指南

大家好&#xff0c;ChatGPT 自诞生以来&#xff0c;凭借划时代的创新&#xff0c;被无数人一举送上生成式 AI 的神坛。在使用时&#xff0c;总是期望它能准确理解我们的意图&#xff0c;却时常发现其回答或创作并非百分之百贴合期待。这种落差可能源于我们对于模型性能的过高期…...

网站建设品牌推广seo/软文一般发布在哪些平台

目前 &#xff0c;Hooks 应该是 React 中最火的概念了&#xff0c;在阅读这篇文章之前&#xff0c;希望你已经了解了基本的 Hooks 是什么&#xff1f; 下面就介绍一下简单的使用场景 react hooks useState useState是react自带的一个hook函数&#xff0c;它的作用就是用来声…...

公司做的网站费用如何做账/石家庄房价

使用“查找并替换”选项可以一次性替换文档中的特定文本。这样&#xff0c;您不必手动定位和更新整个文档中每次出现的文本。本文甚至更进一步&#xff0c;介绍了如何在PDF文档中自动查找和替换文本功能。特别是&#xff0c;将学习如何使用C&#xff03;在整个PDF&#xff0c;特…...

奉化区建设局网站/推广网址

http://codeforces.com/problemset/problem/580/B 题意&#xff1a;Kefa有n个朋友&#xff0c;要和这n个朋友中的一些出去&#xff0c;这些朋友有一些钱&#xff0c;并且和Kefa有一定的友谊值&#xff0c;要求这些朋友间的贫富差距&#xff08;拥有的钱的数量&#xff09;小于d…...

服务器托管多少钱/简述seo的概念

刚POJ水到100了&#xff0c;哎呀&#xff0c;爆水的题目&#xff0c;没太看懂的题意&#xff0c;实在是快点想秒了这个水题&#xff0c;看了看DISCUSS,就给水过了&#xff0c;掉人品啊。。。 区域赛完了真是感觉没啥事干了&#xff0c;这几天想了好多&#xff0c;想想比赛的过程…...

网站域名授权/新闻摘抄四年级下册

文件测试运算符 文件测试运算符用于检测 Unix 文件的各种属性。 属性检测描述如下&#xff1a; 操作符说明举例-b file检测文件是否是块设备文件&#xff0c;如果是&#xff0c;则返回 true。[ -b $file ] 返回 false。-c file检测文件是否是字符设备文件&#xff0c;如果是…...

深圳网站建设公司服务商/谷歌广告代理公司

编译时报错如下&#xff1a; /usr/include/libavutil/common.h:168: 错误:UINT64_C was not declared in this scope 解决&#xff1a; 在common.h里面添加#ifndef UINT64_C #define UINT64_C(value)__CONCAT(value,ULL) #endif 视图如下&#xff1a;...