Commit dda11c52 authored by 罗显健's avatar 罗显健
parents 988d4a63 12385a84
......@@ -62,6 +62,11 @@
<Reference Include="NPOI.OpenXmlFormats, Version=2.5.1.0, Culture=neutral, PublicKeyToken=0df73ec7942b34e1, processorArchitecture=MSIL">
<HintPath>..\FunnyPick\packages\NPOI.2.5.1\lib\net45\NPOI.OpenXmlFormats.dll</HintPath>
</Reference>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="QRCoder, Version=1.6.0.0, Culture=neutral, PublicKeyToken=c4ed5b9ae8358a28, processorArchitecture=MSIL">
<HintPath>..\packages\QRCoder.1.6.0\lib\net40\QRCoder.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
......@@ -75,6 +80,7 @@
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="MyCommon\Log.cs" />
......@@ -324,6 +330,12 @@
<Compile Include="UI\wMuiltTaskSimulate.Designer.cs">
<DependentUpon>wMuiltTaskSimulate.cs</DependentUpon>
</Compile>
<Compile Include="UI\wQRCode.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UI\wQRCode.Designer.cs">
<DependentUpon>wQRCode.cs</DependentUpon>
</Compile>
<Compile Include="UI\wSysModule.cs">
<SubType>Form</SubType>
</Compile>
......@@ -482,6 +494,9 @@
<EmbeddedResource Include="UI\wMuiltTaskSimulate.resx">
<DependentUpon>wMuiltTaskSimulate.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wQRCode.resx">
<DependentUpon>wQRCode.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\wSysModule.resx">
<DependentUpon>wSysModule.cs</DependentUpon>
</EmbeddedResource>
......
namespace Tools.UI
{
partial class wQRCode
{
/// <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.splitContainer1 = new System.Windows.Forms.SplitContainer();
this.txtdate = new System.Windows.Forms.TextBox();
this.panel3 = new System.Windows.Forms.Panel();
this.label2 = new System.Windows.Forms.Label();
this.toolStrip1 = new System.Windows.Forms.ToolStrip();
this.tsbentity = new System.Windows.Forms.ToolStripButton();
this.flPQR = new System.Windows.Forms.FlowLayoutPanel();
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit();
this.splitContainer1.Panel1.SuspendLayout();
this.splitContainer1.Panel2.SuspendLayout();
this.splitContainer1.SuspendLayout();
this.panel3.SuspendLayout();
this.toolStrip1.SuspendLayout();
this.SuspendLayout();
//
// splitContainer1
//
this.splitContainer1.Dock = System.Windows.Forms.DockStyle.Fill;
this.splitContainer1.FixedPanel = System.Windows.Forms.FixedPanel.Panel1;
this.splitContainer1.Location = new System.Drawing.Point(0, 25);
this.splitContainer1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.splitContainer1.Name = "splitContainer1";
//
// splitContainer1.Panel1
//
this.splitContainer1.Panel1.Controls.Add(this.txtdate);
this.splitContainer1.Panel1.Controls.Add(this.panel3);
//
// splitContainer1.Panel2
//
this.splitContainer1.Panel2.Controls.Add(this.flPQR);
this.splitContainer1.Size = new System.Drawing.Size(796, 675);
this.splitContainer1.SplitterDistance = 168;
this.splitContainer1.SplitterWidth = 5;
this.splitContainer1.TabIndex = 8;
//
// txtdate
//
this.txtdate.Dock = System.Windows.Forms.DockStyle.Fill;
this.txtdate.Location = new System.Drawing.Point(0, 19);
this.txtdate.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.txtdate.Multiline = true;
this.txtdate.Name = "txtdate";
this.txtdate.ScrollBars = System.Windows.Forms.ScrollBars.Both;
this.txtdate.Size = new System.Drawing.Size(168, 656);
this.txtdate.TabIndex = 5;
//
// panel3
//
this.panel3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
this.panel3.Controls.Add(this.label2);
this.panel3.Dock = System.Windows.Forms.DockStyle.Top;
this.panel3.Location = new System.Drawing.Point(0, 0);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(168, 19);
this.panel3.TabIndex = 4;
//
// label2
//
this.label2.AutoSize = true;
this.label2.Location = new System.Drawing.Point(11, 2);
this.label2.Name = "label2";
this.label2.Size = new System.Drawing.Size(29, 12);
this.label2.TabIndex = 2;
this.label2.Text = "内容";
//
// toolStrip1
//
this.toolStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.tsbentity});
this.toolStrip1.Location = new System.Drawing.Point(0, 0);
this.toolStrip1.Name = "toolStrip1";
this.toolStrip1.Size = new System.Drawing.Size(796, 25);
this.toolStrip1.TabIndex = 9;
this.toolStrip1.Text = "toolStrip1";
//
// tsbentity
//
this.tsbentity.Image = global::Tools.Properties.Resources.实体类;
this.tsbentity.ImageTransparentColor = System.Drawing.Color.Magenta;
this.tsbentity.Name = "tsbentity";
this.tsbentity.Size = new System.Drawing.Size(88, 22);
this.tsbentity.Text = "生成二维码";
this.tsbentity.Click += new System.EventHandler(this.tsbentity_Click);
//
// flPQR
//
this.flPQR.AutoScroll = true;
this.flPQR.Dock = System.Windows.Forms.DockStyle.Fill;
this.flPQR.Location = new System.Drawing.Point(0, 0);
this.flPQR.Name = "flPQR";
this.flPQR.Size = new System.Drawing.Size(623, 675);
this.flPQR.TabIndex = 0;
//
// wQRCode
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(796, 700);
this.Controls.Add(this.splitContainer1);
this.Controls.Add(this.toolStrip1);
this.Name = "wQRCode";
this.Text = "生成二维码";
this.splitContainer1.Panel1.ResumeLayout(false);
this.splitContainer1.Panel1.PerformLayout();
this.splitContainer1.Panel2.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).EndInit();
this.splitContainer1.ResumeLayout(false);
this.panel3.ResumeLayout(false);
this.panel3.PerformLayout();
this.toolStrip1.ResumeLayout(false);
this.toolStrip1.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.SplitContainer splitContainer1;
private System.Windows.Forms.ToolStrip toolStrip1;
private System.Windows.Forms.ToolStripButton tsbentity;
private System.Windows.Forms.Panel panel3;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.TextBox txtdate;
private System.Windows.Forms.FlowLayoutPanel flPQR;
}
}
\ No newline at end of file
using QRCoder;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace Tools.UI
{
public partial class wQRCode : Form
{
public wQRCode()
{
InitializeComponent();
}
/// <summary>
/// 生成二维码
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void tsbentity_Click(object sender, EventArgs e)
{
List<string> lists = ParseText();
ClearFlowLayoutPanel(flPQR);
if (lists.Count == 0) return;
DisplayQRCodes(lists, flPQR);
}
/// <summary>
/// 解析文本
/// </summary>
/// <returns></returns>
public List<string> ParseText()
{
List<string> result = new List<string>();
if (!string.IsNullOrEmpty(txtdate.Text))
{
string text = txtdate.Text;
string[] items = text.Split(new string[] { "\r\n" }, StringSplitOptions.RemoveEmptyEntries);
foreach (var item in items)
{
result.Add(item.Trim()); // 去除前后空格
}
}
return result;
}
/// <summary>
/// 加载二维码到FlowLayoutPanel
/// </summary>
/// <param name="lists">二维码内容</param>
/// <param name="panel">控件</param>
public void DisplayQRCodes(List<string> lists, FlowLayoutPanel flowLayoutPanel)
{
foreach (var list in lists)
{
QRCodePanel qrCodePanel = new QRCodePanel(list);
flowLayoutPanel.Controls.Add(qrCodePanel);
}
}
/// <summary>
/// 清除FlowLayoutPanel内的控件
/// </summary>
/// <param name="flowLayoutPanel">控件</param>
private void ClearFlowLayoutPanel(FlowLayoutPanel flowLayoutPanel)
{
//检查FlowLayoutPanel是否包含控件
if (flowLayoutPanel.Controls.Count > 0)
{
List<Control> controlsToRemove = new List<Control>();
// 遍历FlowLayoutPanel中的所有控件
foreach (Control control in flowLayoutPanel.Controls)
{
// 将控件添加到要移除的列表中
controlsToRemove.Add(control);
}
foreach (Control control in controlsToRemove)
{
// 从FlowLayoutPanel中移除控件
flowLayoutPanel.Controls.Remove(control);
}
}
}
}
public class QRCodePanel : Panel
{
private PictureBox pictureBox;
private Label label;
public QRCodePanel(string qrText, int width = 100, int height = 100)
{
// 初始化PictureBox
pictureBox = new PictureBox
{
SizeMode = PictureBoxSizeMode.Zoom,
Size = new Size(width, height) // 设置二维码大小
};
// 使用QRCoder生成二维码并赋值给PictureBox
QRCodeGenerator qrGenerator = new QRCodeGenerator();
QRCodeData qrCodeData = qrGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
QRCode qrCode = new QRCode(qrCodeData);
Bitmap qrCodeImage = qrCode.GetGraphic(10);
Bitmap resizedImage = new Bitmap(pictureBox.Width, pictureBox.Height);
using (Graphics graphic = Graphics.FromImage(resizedImage))
{
graphic.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
graphic.DrawImage(qrCodeImage, new Rectangle(0, 0, resizedImage.Width, resizedImage.Height));
}
pictureBox.Image = resizedImage;
// 初始化Label
label = new Label
{
Text = qrText,
TextAlign = ContentAlignment.MiddleCenter,
AutoSize = true,
};
// 将控件添加到自定义Panel中
Controls.Add(pictureBox);
Controls.Add(label);
// 设置自定义Panel的大小以适应子控件
this.AutoSize = true;
this.AutoSizeMode = AutoSizeMode.GrowAndShrink;
}
protected override void OnResize(EventArgs eventargs)
{
// 重新定位pictureBox以确保它始终居中
pictureBox.Location = new Point((this.Width - pictureBox.Width) / 2, 0);
// 重新定位Label以确保它始终居中并位于PictureBox下方
label.Location = new Point((Width - label.Width) / 2, pictureBox.Bottom + 5);
base.OnResize(eventargs);
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>
\ No newline at end of file
......@@ -3,5 +3,6 @@
<package id="Newtonsoft.Json" version="12.0.1" targetFramework="net48" />
<package id="NPOI" version="2.5.1" targetFramework="net461" />
<package id="Portable.BouncyCastle" version="1.8.6" targetFramework="net461" />
<package id="QRCoder" version="1.6.0" targetFramework="net48" />
<package id="SharpZipLib" version="1.3.2" targetFramework="net461" />
</packages>
\ No newline at end of file
......@@ -62,6 +62,7 @@ namespace Tools
this.CreateModule(Tools_dev, typeof(UI.wSysChecker), "检查配置工具", "tr:系统通用检查配置服务(通过存储过程检查)"),
this.CreateModule(Tools_dev, typeof(UI.wMuiltTaskSimulate), "批量并行任务模拟", "lxj:多线程并行运行指定测试项目,用来做压力性能测试等。。。"),
this.CreateModule(Tools_dev, typeof(UI.wAutoModel), "模型生成工具", "tb:将Excel字段名、描述复制到指定区域,生成为模型类"),
this.CreateModule(Tools_dev, typeof(UI.wQRCode), "生成二维码", "tb:将提供的内容复制到指定区域,生成二维码"),
//-------------------------------
this.CreateModule(Tools_human, typeof(UI.wUser), "员工管理", "tr:员工状态及头像管理"),
this.CreateModule(Tools_human, typeof(UI.wEvaluationOfEmployee), "员工考核", "tr:员工考核的记录工具"),
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment