Ejemplo n.º 1
0
        public override void Draw()
        {
            Lcd.DrawRectangle(outherBox, true, true);
            Lcd.DrawRectangle(innerBox, Selected, true);
            string character = SelectedCharacter;

            if (character == null)
            {
                character = " ";
            }
            if (!useSmallFont)
            {
                Lcd.WriteText(resultFont, textCenterPoint, currentLine + SelectedCharacter, !Selected);
                int xUnderLine = innerBox.P1.X + characterEdge + resultFont.TextSize(currentLine).X;
                int yUnderLine = innerBox.P2.Y - 1;
                Lcd.DrawHLine(new Point(xUnderLine, yUnderLine), resultFont.TextSize(character).X, true);
            }
            else
            {
                if (showLine)
                {
                    if (inputLines.Count > 1)
                    {
                        Point topPoint = new Point(innerBox.P1.X + characterEdge, innerBox.P1.Y);
                        Lcd.WriteText(resultFont, topPoint, inputLines [inputLines.Count - 2], !Selected);
                        Lcd.WriteText(resultFont, topPoint + new Point(0, ((int)resultFont.maxHeight - 1)), inputLines [inputLines.Count - 1], !Selected);
                        Lcd.WriteText(resultFont, topPoint + new Point(0, ((int)resultFont.maxHeight - 1) * 2), currentLine + SelectedCharacter, !Selected);
                    }
                    else
                    {
                        Point topPoint = new Point(innerBox.P1.X + characterEdge, textCenterPoint.Y);
                        Lcd.WriteText(resultFont, topPoint, inputLines [inputLines.Count - 1], !Selected);
                        Lcd.WriteText(resultFont, topPoint + new Point(0, (int)resultFont.maxHeight - 1), currentLine + SelectedCharacter, !Selected);
                        int xUnderLine = innerBox.P1.X + characterEdge + resultFont.TextSize(currentLine).X;
                        int yUnderLine = innerBox.P2.Y - 1;
                        Lcd.DrawHLine(new Point(xUnderLine, yUnderLine), resultFont.TextSize(character).X, true);
                    }
                }
                else
                {
                    Lcd.WriteText(resultFont, textCenterPoint + new Point(0, 5), currentLine + SelectedCharacter, !Selected);
                    int xUnderLine = innerBox.P1.X + characterEdge + resultFont.TextSize(currentLine).X;
                    int yUnderLine = innerBox.P2.Y - 1;
                    Lcd.DrawHLine(new Point(xUnderLine, yUnderLine), resultFont.TextSize(character).X, true);
                }
            }
        }
Ejemplo n.º 2
0
        public static void Main(string[] args)
        {
            EventWaitHandle stopped     = new ManualResetEvent(false);
            int             centerX     = Lcd.Width / 2;
            int             centerY     = Lcd.Height / 2;
            Point           center      = new Point(centerX, centerY);
            int             refreshRate = 100;
            bool            run         = true;
            ButtonEvents    buts        = new ButtonEvents();

            buts.EscapePressed += () => {
                stopped.Set();
                run = false;
            };

            while (run)
            {
                for (int k = 0; k < 4; k++)
                {
                    for (int i = 1; i < centerY; i++)
                    {
                        Lcd.Clear();
                        Lcd.DrawCircle(center, (ushort)i, true, true);
                        Lcd.Update();
                        stopped.WaitOne(refreshRate);
                    }
                    for (int i = centerY - 1; i > 0; i--)
                    {
                        Lcd.Clear();
                        Lcd.DrawCircle(center, (ushort)i, true, true);
                        Lcd.Update();
                        stopped.WaitOne(refreshRate);
                    }
                }

                for (int k = 0; k < 20; k++)
                {
                    Lcd.Clear();
                    Lcd.DrawHLine(center, centerX / 2, true);
                    stopped.WaitOne(refreshRate);
                    Lcd.Clear();
                    Lcd.DrawVLine(center, centerY / 2, true);
                }
            }
        }
Ejemplo n.º 3
0
		public void DrawHLine(int x, int y, int length, bool color)
		{
			Lcd.DrawHLine(new Point(x,y), length, color);
			Lcd.Update();
		}