Commit 00dba650 张东亮

新ui

1 个父辈 9fc90979
......@@ -36,6 +36,7 @@ namespace SmartScan
this.flowLayoutPanel1 = new System.Windows.Forms.FlowLayoutPanel();
this.facePanel1 = new Asa.FaceControl.FacePanel();
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.NudMiddleTextCount = new Asa.FaceControl.FaceNumericUpDown();
this.ChkCheckCodeType = new Asa.FaceControl.FaceCheckBox();
this.LblCodeType = new Asa.FaceControl.FaceLabel();
this.ChkMatchingStart = new Asa.FaceControl.FaceCheckBox();
......@@ -46,7 +47,7 @@ namespace SmartScan
this.TxtMatchingMiddleText = new Asa.FaceControl.FaceTextBox();
this.ChkCaseSensitivity = new Asa.FaceControl.FaceCheckBox();
this.ChoMatchMiddleType = new Asa.FaceControl.FaceComboBox();
this.NudMiddleTextCount = new Asa.FaceControl.FaceNumericUpDown();
this.lblMatchRes = new Asa.FaceControl.FaceLabel();
this.facePanel1.SuspendLayout();
this.tableLayoutPanel1.SuspendLayout();
this.SuspendLayout();
......@@ -156,6 +157,7 @@ namespace SmartScan
this.tableLayoutPanel1.Controls.Add(this.TxtMatchingMiddleText, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.ChkCaseSensitivity, 2, 2);
this.tableLayoutPanel1.Controls.Add(this.ChoMatchMiddleType, 0, 3);
this.tableLayoutPanel1.Controls.Add(this.lblMatchRes, 3, 3);
this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel1.Location = new System.Drawing.Point(3, 3);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
......@@ -167,6 +169,28 @@ namespace SmartScan
this.tableLayoutPanel1.Size = new System.Drawing.Size(830, 222);
this.tableLayoutPanel1.TabIndex = 0;
//
// NudMiddleTextCount
//
this.NudMiddleTextCount.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.NudMiddleTextCount.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.NudMiddleTextCount.BorderWidth = 2;
this.NudMiddleTextCount.DecimalPlaces = 0;
this.NudMiddleTextCount.Dock = System.Windows.Forms.DockStyle.Fill;
this.NudMiddleTextCount.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.NudMiddleTextCount.Increment = 1F;
this.NudMiddleTextCount.Location = new System.Drawing.Point(211, 172);
this.NudMiddleTextCount.Margin = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Maximum = 100F;
this.NudMiddleTextCount.Minimum = 1F;
this.NudMiddleTextCount.Name = "NudMiddleTextCount";
this.NudMiddleTextCount.Padding = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Size = new System.Drawing.Size(199, 48);
this.NudMiddleTextCount.TabIndex = 62;
this.NudMiddleTextCount.Text = "1";
this.NudMiddleTextCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.NudMiddleTextCount.Value = 1F;
this.NudMiddleTextCount.ValueChanged += new System.EventHandler(this.matchChanged);
//
// ChkCheckCodeType
//
this.ChkCheckCodeType.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
......@@ -182,6 +206,7 @@ namespace SmartScan
this.ChkCheckCodeType.TabIndex = 52;
this.ChkCheckCodeType.Text = "CheckCodeType";
this.ChkCheckCodeType.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkCheckCodeType.CheckedChanged += new System.EventHandler(this.matchChanged);
//
// LblCodeType
//
......@@ -215,6 +240,7 @@ namespace SmartScan
this.ChkMatchingStart.TabIndex = 54;
this.ChkMatchingStart.Text = "Start";
this.ChkMatchingStart.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingStart.CheckedChanged += new System.EventHandler(this.matchChanged);
//
// TxtMatchingStartText
//
......@@ -235,6 +261,7 @@ namespace SmartScan
this.TxtMatchingStartText.Size = new System.Drawing.Size(199, 48);
this.TxtMatchingStartText.TabIndex = 55;
this.TxtMatchingStartText.Text = "faceTextBox1";
this.TxtMatchingStartText.TextChanged += new System.EventHandler(this.matchChanged);
//
// ChkMatchingEnd
//
......@@ -251,6 +278,7 @@ namespace SmartScan
this.ChkMatchingEnd.TabIndex = 56;
this.ChkMatchingEnd.Text = "End";
this.ChkMatchingEnd.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingEnd.CheckedChanged += new System.EventHandler(this.matchChanged);
//
// TxtMatchingEndText
//
......@@ -271,6 +299,7 @@ namespace SmartScan
this.TxtMatchingEndText.Size = new System.Drawing.Size(201, 48);
this.TxtMatchingEndText.TabIndex = 57;
this.TxtMatchingEndText.Text = "faceTextBox2";
this.TxtMatchingEndText.TextChanged += new System.EventHandler(this.matchChanged);
//
// ChkMatchingMiddle
//
......@@ -287,6 +316,7 @@ namespace SmartScan
this.ChkMatchingMiddle.TabIndex = 58;
this.ChkMatchingMiddle.Text = "Middle";
this.ChkMatchingMiddle.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkMatchingMiddle.CheckedChanged += new System.EventHandler(this.matchChanged);
//
// TxtMatchingMiddleText
//
......@@ -307,6 +337,7 @@ namespace SmartScan
this.TxtMatchingMiddleText.Size = new System.Drawing.Size(199, 48);
this.TxtMatchingMiddleText.TabIndex = 59;
this.TxtMatchingMiddleText.Text = "faceTextBox3";
this.TxtMatchingMiddleText.TextChanged += new System.EventHandler(this.matchChanged);
//
// ChkCaseSensitivity
//
......@@ -323,6 +354,7 @@ namespace SmartScan
this.ChkCaseSensitivity.TabIndex = 60;
this.ChkCaseSensitivity.Text = "Sensitivity";
this.ChkCaseSensitivity.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
this.ChkCaseSensitivity.CheckedChanged += new System.EventHandler(this.matchChanged);
//
// ChoMatchMiddleType
//
......@@ -341,27 +373,21 @@ namespace SmartScan
this.ChoMatchMiddleType.TabIndex = 61;
this.ChoMatchMiddleType.Text = "faceComboBox1";
this.ChoMatchMiddleType.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// NudMiddleTextCount
//
this.NudMiddleTextCount.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.NudMiddleTextCount.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.NudMiddleTextCount.BorderWidth = 2;
this.NudMiddleTextCount.DecimalPlaces = 0;
this.NudMiddleTextCount.Dock = System.Windows.Forms.DockStyle.Fill;
this.NudMiddleTextCount.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.NudMiddleTextCount.Increment = 1F;
this.NudMiddleTextCount.Location = new System.Drawing.Point(211, 172);
this.NudMiddleTextCount.Margin = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Maximum = 100F;
this.NudMiddleTextCount.Minimum = 1F;
this.NudMiddleTextCount.Name = "NudMiddleTextCount";
this.NudMiddleTextCount.Padding = new System.Windows.Forms.Padding(4);
this.NudMiddleTextCount.Size = new System.Drawing.Size(199, 48);
this.NudMiddleTextCount.TabIndex = 62;
this.NudMiddleTextCount.Text = "1";
this.NudMiddleTextCount.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.NudMiddleTextCount.Value = 1F;
this.ChoMatchMiddleType.SelectedIndexChanged += new System.EventHandler(this.matchChanged);
//
// lblMatchRes
//
this.lblMatchRes.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(20)))), ((int)(((byte)(20)))), ((int)(((byte)(20)))));
this.lblMatchRes.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.lblMatchRes.BorderWidth = 0;
this.lblMatchRes.Dock = System.Windows.Forms.DockStyle.Fill;
this.lblMatchRes.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.lblMatchRes.Location = new System.Drawing.Point(625, 172);
this.lblMatchRes.Margin = new System.Windows.Forms.Padding(4);
this.lblMatchRes.Name = "lblMatchRes";
this.lblMatchRes.Padding = new System.Windows.Forms.Padding(4);
this.lblMatchRes.Size = new System.Drawing.Size(201, 48);
this.lblMatchRes.TabIndex = 63;
//
// FrmCodeExtract
//
......@@ -411,5 +437,6 @@ namespace SmartScan
private Asa.FaceControl.FaceCheckBox ChkCaseSensitivity;
private Asa.FaceControl.FaceComboBox ChoMatchMiddleType;
private Asa.FaceControl.FaceNumericUpDown NudMiddleTextCount;
private Asa.FaceControl.FaceLabel lblMatchRes;
}
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using Asa.FaceControl;
using BLL;
using CameraVisionLib.Model;
using Model;
namespace SmartScan
......@@ -22,7 +23,7 @@ namespace SmartScan
int windowHeight = 0;
MaterialCodeMatch matchShared = new MaterialCodeMatch();
public FrmCodeExtract(string codeText, int codeID,string codeType, List<MaterialCodeMatch> match)
public FrmCodeExtract(string codeText, int codeID, string codeType, List<MaterialCodeMatch> match)
{
InitializeComponent();
windowHeight = this.Height;
......@@ -37,7 +38,7 @@ namespace SmartScan
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_max"));
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_equals"));
ChoMatchMiddleType.Items.Add(Language.Dialog("MatchType_min"));
if(match.Count > 0)
if (match.Count > 0)
{
matchShared = match[0];
}
......@@ -71,9 +72,9 @@ namespace SmartScan
btn.Click += Btn_Click;
btn.Tag = "not";
flowLayoutPanel1.Controls.Add(btn);
UsrCodeExtractList list = new(codeText,codeType, codeText.Length, match);
UsrCodeExtractList list = new(codeText, codeType, codeText.Length, match);
list.DelClick += List_DelClick;
list.AddClick += List_AddClick;
list.KeyChanged += List_KeyChanged;
......@@ -96,10 +97,11 @@ namespace SmartScan
BtnAddMatch_Click(sender, e);
}
void clacWindowHeight() {
void clacWindowHeight()
{
if (flowLayoutPanel1.Controls.Count > 14)
{
matchButton.Values.ToList().ForEach((x)=> {x.GetPanel().Top = 418 + 56 * 2; });//184
matchButton.Values.ToList().ForEach((x) => { x.GetPanel().Top = 418 + 56 * 2; });//184
flowLayoutPanel1.Height = 56 * 3;
this.Height = windowHeight + 56 * 2 - 4;
......@@ -175,7 +177,8 @@ namespace SmartScan
foreach (FaceButton btn in matchButton.Keys)
{
string key = matchButton[btn].GetMatchKey();
if (string.IsNullOrWhiteSpace(key)) {
if (string.IsNullOrWhiteSpace(key))
{
string text = Language.Dialog("KeyEmpty");
new FaceMessageBox("", text, MessageBoxButtons.OK).ShowDialog();
......@@ -246,7 +249,68 @@ namespace SmartScan
private void FrmCodeExtract_Load(object sender, EventArgs e)
{
LblCode.Text = codeText;
}
private void matchChanged(object sender, EventArgs e)
{
lblMatchRes.Invoke(new Action(() => {
if(CheckMatch())
{
lblMatchRes.Text = "";
//lblMatchRes.ForeColor = Color.Green;
}
else
{
lblMatchRes.Text = "NG";
lblMatchRes.ForeColor = Color.Red;
}
}));
}
private bool CheckMatch()
{
string code = ChkCaseSensitivity.Checked ? codeText : codeText.ToUpper();
bool ismatch = true;
string text = "";
//开头
if (ChkMatchingStart.Checked)
{
text = ChkCaseSensitivity.Checked ? TxtMatchingStartText.Text : TxtMatchingStartText.Text.ToUpper();
if (!code.StartsWith(text))
ismatch = false;
}
//结尾
if (ChkMatchingEnd.Checked)
{
text = ChkCaseSensitivity.Checked ? TxtMatchingEndText.Text : TxtMatchingEndText.Text.ToUpper();
if (!code.EndsWith(text))
ismatch = false;
}
//中间
if (ChkMatchingMiddle.Checked)
{
int index, count;
text = ChkCaseSensitivity.Checked ? TxtMatchingMiddleText.Text : TxtMatchingMiddleText.Text.ToUpper();
if (text == "") return false;
index = count = 0;
while ((index = code.IndexOf(text, index)) != -1)
{
count++;
index += text.Length;
}
if (count == 0)
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == -1 && count > Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == 0 && count != Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
if (ChoMatchMiddleType.SelectedIndex == 1 && count < Convert.ToInt32(NudMiddleTextCount.Value))
ismatch = false;
}
return ismatch;
}
}
}
......@@ -118,48 +118,55 @@ namespace SmartScan
// if (string.IsNullOrEmpty(text))
// return;
//}
if (ChkMatchingSplit.Checked)
{
string str = Model.MaterialAsciiCode.GetAsciiCode(CboMatchingSplit.Text);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
int index = Convert.ToInt32(NudSplitPart.Value) - 1;
if (index < arr.Length)
text = arr[index];
else
text = "";
}
if (ChkMinLength.Checked)
try
{
if (text.Length < NudMinLength.Value)
text = "";
}
if (ChkMatchingSplit.Checked)
{
string str = Model.MaterialAsciiCode.GetAsciiCode(CboMatchingSplit.Text);
string[] arr = codeText.Split(new string[] { str }, StringSplitOptions.RemoveEmptyEntries);
int index = Convert.ToInt32(NudSplitPart.Value) - 1;
if (index < arr.Length)
text = arr[index];
else
text = "";
}
if (ChkMaxLength.Checked)
{
if (text.Length > NudMaxLength.Value)
text = "";
}
if (ChkMinLength.Checked)
{
if (text.Length < NudMinLength.Value)
text = "";
}
if (text.Length > 0)
{
int startIndex = Convert.ToInt32(NudStart.Value);
int length = Convert.ToInt32(NudLength.Value);
if (ChkLengthEnd.Checked)
if (ChkMaxLength.Checked)
{
text = text.Substring(startIndex);
if (text.Length > NudMaxLength.Value)
text = "";
}
else
if (text.Length > 0)
{
if (startIndex + length <= text.Length)
text = text.Substring(startIndex, length);
int startIndex = Convert.ToInt32(NudStart.Value);
int length = Convert.ToInt32(NudLength.Value);
if (ChkLengthEnd.Checked)
{
text = text.Substring(startIndex);
}
else
text = "";
{
if (startIndex + length <= text.Length)
text = text.Substring(startIndex, length);
else
text = "";
}
}
}
faceTextBox1.Text = text;
faceTextBox1.Text = text;
}catch(Exception ex)
{
faceTextBox1.Text = "";
LogNet.log.Error("ShowPreview", ex);
}
}
private void ChkLengthEnd_CheckedChanged(object sender, EventArgs e)
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!