我在我的 POS c# 应用程序中使用了极显示(E POS)。我有两个主要问题,1. 我不能完美地清除显示。2. 无法设置光标位置。
I used some dirty tricks to do these.But I am not satisfied with that code.The following code i used.
代码 :-
class PoleDisplay : SerialPort
{
private SerialPort srPort = null;
public PoleDisplay()
{
try
{
srPort = new SerialPort("COM1", 9600, Parity.None, 8, StopBits.One);
if (!srPort.IsOpen) srPort.Open();
}
catch { }
}
~PoleDisplay()
{
srPort.Close();
}
//To clear Display.....
public void ClearDisplay()
{
srPort.Write(" ");
srPort.WriteLine(" ");
}
//Display Function
//'line' 1 for First line and 0 For second line
public void Display(string textToDisplay, int line)
{
if (line == 0)
srPort.Write(textToDisplay);
else
srPort.WriteLine(textToDisplay);
}
}