解决这个问题的方法是为字母表的每个字符设置一个 6 x 5 数组,例如:
int[][] letterA = { { 0, 0, 1, 1, 0, 0 },
{ 0, 1, 0, 0, 1, 0 },
{ 1, 1, 0, 0, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 1, 1, 1, 1 },
{ 1, 1, 0, 0, 1, 1 },
{ 1, 1, 0, 0, 1, 1 }};
然后,您将合并构建键入的单词所需的字母。
因此,随着需要打开的 LED,每条线都会变得更长。
这就是应用程序的业务逻辑。
您现在要创建一个有限 LED 灯组,例如 60 x 10 并从最右侧开始,如果当前数组值为 1,则显示黄色圆圈,否则显示黑色。
希望有帮助。
编辑:以编程方式在表单上渲染圆圈。
您可以创建一个计时器,而不是删除面板中的所有控件,然后您可以执行以下操作:
//word is the merged array of letters like the one above
foreach(int[] line in word)
{
//currentShiftIndex is the shift amount to render control from left to right
int currentShiftIndex = 1;
foreach(int i in line)
{
//set up a control called 'light' for example [im not including that]
light.Left = currentShiftIndex * 10;
light.Background = i == 1 ? "Yellow" : "Black"
}
}
那纯粹是渲染一行的示例。忽略任何错误的语法。我纯粹只是举例说明这个过程。
我希望这会有所帮助。