Commit 8c307787 刘韬

1

1 个父辈 83a938e3
...@@ -11,7 +11,7 @@ namespace BLL ...@@ -11,7 +11,7 @@ namespace BLL
/// <summary> /// <summary>
/// 标签打印 /// 标签打印
/// </summary> /// </summary>
internal class LabelPrint public class LabelPrint
{ {
private PictureBox _pic; private PictureBox _pic;
private XmlDocument _doc; private XmlDocument _doc;
...@@ -205,17 +205,37 @@ namespace BLL ...@@ -205,17 +205,37 @@ namespace BLL
label.Path = file[i]; label.Path = file[i];
label.Name = _root.Attributes["Name"].Value; label.Name = _root.Attributes["Name"].Value;
label.SetSize(_root.Attributes["Size"].Value); label.SetSize(_root.Attributes["Size"].Value);
if (_root.Attributes["Offset"]!=null)
label.SetOffset(_root.Attributes["Offset"].Value); label.SetOffset(_root.Attributes["Offset"].Value);
else
label.SetOffset("0,0");
XmlNodeList list = _root.ChildNodes; XmlNodeList list = _root.ChildNodes;
for (int j = 0; j < list.Count; j++) for (int j = 0; j < list.Count; j++)
{ {
Model.LabelFieldType type = Model.LabelFieldType.Text;
if (int.TryParse(list[j].Attributes["Type"].Value, out _)) {
type = (Model.LabelFieldType)Convert.ToInt32(list[j].Attributes["Type"].Value);
}
else {
Enum.TryParse<Model.LabelFieldType>(list[j].Attributes["Type"].Value, out type);
}
string key = "";
if (list[j].Attributes["Key"] != null)
key = list[j].Attributes["Key"].Value;
else if(list[j].Attributes["Text"] != null)
key = list[j].Attributes["Text"].Value;
Model.ClsLabelField field = new Model.ClsLabelField Model.ClsLabelField field = new Model.ClsLabelField
{ {
Type = (Model.LabelFieldType)Convert.ToInt32(list[j].Attributes["Type"].Value), Type = type,
FormatText = list[j].Attributes["Key"].Value
FormatText = key
}; };
field.SetLocationSize(list[j].Attributes["Rect"].Value); string rect;
if (list[j].Attributes["Rect"] != null)
rect = list[j].Attributes["Rect"].Value;
else
rect = list[j].Attributes["Rectangle"].Value;
field.SetLocationSize(rect);
field.SetFont(list[j].Attributes["Font"].Value); field.SetFont(list[j].Attributes["Font"].Value);
field.SetBarQRCode(field.FormatText); field.SetBarQRCode(field.FormatText);
label.Field.Add(field); label.Field.Add(field);
...@@ -463,6 +483,7 @@ namespace BLL ...@@ -463,6 +483,7 @@ namespace BLL
/// <returns></returns> /// <returns></returns>
public Bitmap PrintPreview(Dictionary<string, string> text, out string[] codeContent) public Bitmap PrintPreview(Dictionary<string, string> text, out string[] codeContent)
{ {
text = new Dictionary<string, string>(text,StringComparer.OrdinalIgnoreCase);
codeContent = null; codeContent = null;
if (labelIdx == -1) return null; if (labelIdx == -1) return null;
...@@ -861,7 +882,7 @@ namespace BLL ...@@ -861,7 +882,7 @@ namespace BLL
e.Graphics.DrawImage(field.Image, new RectangleF(field.Location_px, field.Size_px)); e.Graphics.DrawImage(field.Image, new RectangleF(field.Location_px, field.Size_px));
} }
//边框 //边框
e.Graphics.DrawRectangle(Pens.LightGray, field.Location_px.X, field.Location_px.Y, field.Size_px.Width, field.Size_px.Height); //e.Graphics.DrawRectangle(Pens.LightGray, field.Location_px.X, field.Location_px.Y, field.Size_px.Width, field.Size_px.Height);
} }
} }
......
...@@ -290,7 +290,7 @@ namespace Model ...@@ -290,7 +290,7 @@ namespace Model
//Height = 70, //Height = 70,
Margin = 1 Margin = 1
}; };
writer.Options.PureBarcode = true;
switch (Type) switch (Type)
{ {
case LabelFieldType.Code39: case LabelFieldType.Code39:
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!