You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
149 lines
4.5 KiB
C#
149 lines
4.5 KiB
C#
using DevComponents.DotNetBar;
|
|
using DevComponents.DotNetBar.Metro;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Data;
|
|
using System.Drawing;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
|
|
namespace POSV.Component
|
|
{
|
|
public partial class RePrintSelectForm : BusinessForm
|
|
{
|
|
public RePrintSelectForm()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
|
|
protected override void OnLoad(EventArgs e)
|
|
{
|
|
base.OnLoad(e);
|
|
if (DesignMode) return;
|
|
|
|
InstallAllPrintType();
|
|
}
|
|
|
|
private void InstallAllPrintType()
|
|
{
|
|
ItemContainer ic = new ItemContainer();
|
|
ic.MultiLine = true;
|
|
ic.ItemSpacing = 0;
|
|
ic.LayoutOrientation = eOrientation.Horizontal;
|
|
|
|
bool onlyTicket = true;
|
|
|
|
//小票
|
|
var item = GetItemTemplate();
|
|
item.Text = PrintTypeEnum.小票.ToString();
|
|
ic.SubItems.Add(item);
|
|
|
|
//标签
|
|
var enablePrintLabel = Global.Instance.GlobalConfigBoolValue(ConfigConstant.PERIPHERAL_LABEL_PRINT_ONSALE, false);
|
|
if (enablePrintLabel)
|
|
{
|
|
item = GetItemTemplate();
|
|
item.Text = PrintTypeEnum.标签.ToString();
|
|
ic.SubItems.Add(item);
|
|
onlyTicket = false;
|
|
}
|
|
|
|
var allowKitchenPrinter = Global.Instance.GlobalConfigBoolValue(ConfigConstant.PERIPHERAL_KITCHEN_ALLOW_CHUDA, false);
|
|
if (allowKitchenPrinter)
|
|
{
|
|
//厨打
|
|
item = GetItemTemplate();
|
|
item.Text = PrintTypeEnum.厨打.ToString();
|
|
ic.SubItems.Add(item);
|
|
//出品
|
|
item = GetItemTemplate();
|
|
item.Text = PrintTypeEnum.出品.ToString();
|
|
ic.SubItems.Add(item);
|
|
|
|
onlyTicket = false;
|
|
}
|
|
|
|
//厨打标签
|
|
var enablePrintChudaLabel = Global.Instance.GlobalConfigBoolValue(ConfigConstant.PERIPHERAL_KITCHEN_ALLOW_CHUDA_LABEL, false);
|
|
if (enablePrintChudaLabel)
|
|
{
|
|
item = GetItemTemplate();
|
|
item.Text = PrintTypeEnum.厨打标签.ToString();
|
|
ic.SubItems.Add(item);
|
|
onlyTicket = false;
|
|
}
|
|
|
|
this.itemPanel1.Items.Add(ic);
|
|
this.itemPanel1.Invalidate();
|
|
|
|
|
|
if(onlyTicket)
|
|
{
|
|
//仅有小票打印,直接打印
|
|
OnItemMouseDown(item, null);
|
|
}
|
|
}
|
|
|
|
private MetroTileItem GetItemTemplate()
|
|
{
|
|
MetroTileItem template = new MetroTileItem();
|
|
|
|
template.TileStyle.PaddingLeft = template.TileStyle.PaddingRight = -2;
|
|
|
|
template.EnableMarkup = true;
|
|
template.OptionGroup = "print";
|
|
|
|
template.TileStyle.Font = this.itemPanel1.Font;
|
|
|
|
//this.itemPanel1.ResizeItemsToFit = false;
|
|
this.itemPanel1.BackgroundStyle.Class = "MetroTileGroupTitle";//很关键
|
|
|
|
template.TileStyle.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
|
template.TileStyle.TextLineAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Center;
|
|
|
|
template.TileStyle.TextColor = Color.White;
|
|
template.TitleTextColor = Color.White;
|
|
|
|
template.TileStyle.BackColor = Color.DimGray;
|
|
template.TileStyle.BackColor2 = Color.DimGray;
|
|
template.TileStyle.BorderWidth = 1;
|
|
template.TileStyle.BorderColor = Color.DimGray;
|
|
template.TileStyle.BorderColor2 = Color.DimGray;
|
|
|
|
|
|
//显示大小
|
|
template.TileSize = new Size(100, 100);
|
|
|
|
//圆角
|
|
template.TileStyle.CornerType = DevComponents.DotNetBar.eCornerType.Rounded;
|
|
|
|
template.MouseDown += OnItemMouseDown;
|
|
|
|
return template;
|
|
}
|
|
|
|
private void OnItemMouseDown(object sender, MouseEventArgs e)
|
|
{
|
|
var tile = sender as MetroTileItem;
|
|
|
|
this.OnAcceptButtonClick(new TransparentEventArgs(TransparentAction.Accept, "printType", tile.Text));
|
|
|
|
OnCloseTouchClick(this, null);
|
|
|
|
}
|
|
|
|
private void OnCloseTouchClick(object sender, TouchEventArgs e)
|
|
{
|
|
if (this.Owner != null)
|
|
{
|
|
this.Owner.DialogResult = this.DialogResult;
|
|
this.Owner.Close();
|
|
}
|
|
this.Close();
|
|
}
|
|
}
|
|
}
|