Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The below code is written for the POS Display Unit. I want to scroll the text in the display. I have tried the Marquee and Scroll properties. But It's not working. I've found that device not supported for Marquee. But I must do it. I heard that using timers it can be possible even the device not supporting Marquee. Can anyone help me on this?

Thanks in advance.

using Microsoft.PointOfService;

private const string WelcomeMessage = "Welcome to Restaurant\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)
{

}
}
Posted

1 solution

If you want to use timer
put one timer control in the form
then
whenever you want to move the text.
you can enable timer (timer1.Enabled=true;)
set time interval property according to your use better keep it as 1000
then use timer's tick event to change display text's position/coordinates/Location,
if you dont want to move the text you can disable the timer so tick event will not be fired
 
Share this answer
 
Comments
Krishnananthan Vijayaretnam 26-Jun-13 3:21am    
This is my code. I want to move the text. And its not working yet. What's my mistake? Is there any simple way rather than this?Need help.

namespace VDINE_POS_MARQUEE
{
public partial class Form1 : Form
{
static PosExplorer myExplorer;
static LineDisplay myDisplay;
static DeviceInfo device1;

private static readonly string displaySpace = " ";
private static readonly int displayLineWidth = 40;
private static readonly int displayLineShowableWidth = 20;

private static string line1String, line2String;
private static string line1StringDisplay, line2StringDisplay;
private static int line1DisplayStartIndex, line2DisplayStartIndex;

public Form1()
{
InitializeComponent();
// Instantiate the timer
timer2.Interval = 1000; //1000ms = 1sec
timer2.Tick += new EventHandler(timer2_Tick);
timer2.Start();
timer2.Enabled = true;
myExplorer = new PosExplorer(this);
device1 = myExplorer.GetDevice("LineDisplay", "POSIFLEX_LINEDISPLAY");
}

private void timer2_Tick(object sender, EventArgs e)
{
try
{
myDisplay = (LineDisplay)myExplorer.CreateInstance(device1);
myDisplay.Open();
myDisplay.Claim(1000);
myDisplay.DeviceEnabled = true;

line1StringDisplay = "Welcome To Tea Club ";

myDisplay.DisplayText(GetDisplayStringSplitByIndex(line1StringDisplay, 19));
////myDisplay.DisplayTextAt(1,1,GetDisplayStringSplitByIndex(line2StringDisplay, 0));
////GetDisplayStringSplitByIndex


if (Form1.line1String.Length > Form1.displayLineShowableWidth)
{
if ((Form1.line1String + Form1.displaySpace).Length < Form1.line1DisplayStartIndex + 1)
{
Form1.line1DisplayStartIndex = 0;
}

Form1.line1StringDisplay = Form1.GetDisplayStringSplitByIndex(Form1.line1String + Form1.displaySpace, Form1.line1DisplayStartIndex++);
}
else
{
Form1.line1StringDisplay = Form1.GetPaddedStringForDisplay(Form1.line1String);
}

if (Form1.line2String.Length > Form1.displayLineShowableWidth)
{
if ((Form1.line2String + Form1.displaySpace).Length < Form1.line2DisplayStartIndex + 1)
{
Form1.line2DisplayStartIndex = 0;
}

Form1.line2StringDisplay = Form1.GetDisplayStringSplitByIndex(Form1.line2String + Form1.displaySpace, Form1.line2DisplayStartIndex++);
}
else
{
Form1.line2StringDisplay = Form1.GetPaddedStringForDisplay(Form1.line2String);
}
myDisplay.Close();
}


catch
{

}

}

private static string GetDisplayStringSplitByIndex(string displayString, int index)
{
return Form1.GetPaddedStringForDisplay(displayString.Substring(index) + displayString.Substring(0, index));
}

private static string GetPaddedStringForDisplay(string displayString)
{
if (displayString.Length > Form1.displayLineWidth)
{
return displayString.Substring(0, Form1.displayLineWidth);
}
else
{
return displayString.PadRight(Form1.displayLineWidth);
}

}
}
}

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900