【问题标题】:How to Display Text and Clear the Text of Partner CD7220-UN Customer Display / Pole Display合作伙伴CD7220-UN客户显示器/立杆显示器如何显示文字和清除文字
【发布时间】:2014-08-29 08:57:17
【问题描述】:

我有一个 Partner Tech CD7220-U 1.0 客户显示器,我正在尝试使用 C# 开发一个 POS 系统。我需要使用客户显示器显示单价和总金额。 所以我搜索了谷歌,发现很少有解决方案可以在显示屏上显示文本。 这是我关注的链接,

1)http://www.codeproject.com/Questions/67846/How-to-display-text-on-USB-Posiflex-Customer-Displ

2)http://www.codeproject.com/Tips/658377/PartnerTech-CD-POS-Customer-Display-NET-Class

在示例(1)中

    using Microsoft.PointOfService;

private const string WelcomeMessage = "Welcome\r\n";
private PosExplorer posExplorer;
private LineDisplay posLineDisplay;
private DeviceInfo posLineDisplaydevice;

public void LineDisplayUnit()
{
this.posExplorer = new PosExplorer(this);
this.posLineDisplaydevice = this.posExplorer.GetDevice("LineDisplay", "POSIFLEX_LINEDISPLAY");

try
{
this.posLineDisplay = (LineDisplay)this.posExplorer.CreateInstance(this.posLineDisplaydevice);
this.posLineDisplay.Open();
this.posLineDisplay.Claim(1000);
this.posLineDisplay.DeviceEnabled = true;
this.posLineDisplay.DisplayText(WelcomeMessage);
this.posLineDisplay.DisplayTextAt(2, 1, this.LeftAlign("Amount", 7) + this.RightAlign(this.GrandTotalAmount.ToString("0.00"), 12));
this.posLineDisplay.Close();

}
catch (Exception)
{

}
}

我有以下异常

例如,我可以将文本发送到客户显示器。但我无法清除屏幕。

这是代码

public void WriteSomethingRedToPrinterThroughDisplay()
    {
        cUSB.OpenPort(); // Open the USB Port
        cUSB.WritePort(Strings.Chr(12));   // Clear pole display
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(61) + 
        Strings.Chr(1));   // Send print through pole display
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(64));   // Initialize printer
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(114) + 
        Strings.Chr(1));   // Select Red color to print
        cUSB.WritePort(string.Format("{0,-10}{1,7:-0.000}
        {2,10:0.00}{3,13:-0.00}", tempitemid, tempunits, 
        tempunitprice, tempsubtotal) + Strings.Chr(10));   // Print text and new line
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(114) + 
        Strings.Chr(0));   // Set color to default Black
        cUSB.WritePort(Strings.Chr(27) + Strings.Chr(61) + 
        Strings.Chr(2));   // De-select printer and enable pole display
        cUSB.ClosePort();  // Close the USB Port
    }

请发给我正确的教程或正确的方法在显示单元中显示文本。非常感谢您的帮助。

【问题讨论】:

    标签: c# point-of-sale


    【解决方案1】:

    使用您上面提到的second link

    您可以按原样使用public class USB。 使用cUSB.WritePort("\f")清除极点显示。

    private void button1_Click(object sender, EventArgs e)
    {
    cUSB.OpenPort(); // Open the USB Port
    cUSB.WritePort("\f"); // Clear pole display
    cUSB.ClosePort();
    } 
    

    我认为下面的代码对你也有用。

    \f - 清屏

    \n - 用制表符换行

    \r - 下一行

    \t - 制表符

    \v - 第一行第一列

    【讨论】:

    • 感谢您的帮助。它运作良好。非常感谢您的帮助。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-08-14
    • 2014-11-28
    • 2016-04-30
    • 2021-10-28
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多