using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace LCD
{
    public partial class LCD : UserControl
    {
        public LCD()
        {
            InitializeComponent();
            Zobrazeni = zobrazeni.Vychozi;
            _Sloupce = 11;
            _Radky = 11;

            //this._nastaveni = new string[2];
            //this._nastaveni[0] = "IOI";
            //this._nastaveni[1] = "IOOOOI";

            this._text = new string[] { "◙" };

            //Výchozí barva LEDek na displeji
            this._BarvaZapLED = new SolidBrush(Color.Lime);
            this._BarvaVypLed = new SolidBrush(Color.DarkGreen);
        }

        public enum zobrazeni { Vychozi, Srdce, Smajlik, CheckIn, Fill, Dacan, DacanII, SineWave, SquareWave, Ruka, Text, };

        //konstanty
        public const bool I = true;
        public const bool O = false;
        
        //privátní členy
        private int _pocetbodu; //Vrátí počet bodů
        private string[] _nastaveni;
        private zobrazeni _zobrazeni;
        private int _Sloupce;
        private int _Radky;
        private SolidBrush _BarvaZapLED;
        private SolidBrush _BarvaVypLed;
        private string[] _text;

        private void UserControl1_Paint(object sender, PaintEventArgs e)
        {
            Graphics surface = e.Graphics;

            //Nastavení velikosti displeje v počtu LEDek (Sloupce x Řádky)
            int PocetRadku = this._Radky;
            int PocetBodu = this._Sloupce;

            //Nastavení fyzické velikosti displeje
            this.Width = this._Sloupce * 4 + 2;
            this.Height = this._Radky * 4 + 2;

            Brush ZapLed = this._BarvaZapLED;
            Brush VypLed = this._BarvaVypLed;

            //přenesení řádků a sloupců
            this._Radky = PocetRadku;
            this._Sloupce = PocetBodu;

            this._pocetbodu = PocetBodu * PocetRadku;

            //if (first)
            //{
            //    this._nastaveni = new bool[] { I, I, I, I, I, I, I, I, I, I, I,
            //                              I, O, O, O, O, O, O, O, O, O, I,
            //                              I, O, I, I, I, O, I, O, I, O, I,
            //                              I, O, I, O, I, O, I, O, I, O, I,
            //                              I, O, I, O, I, O, I, I, O, O, I,
            //                              I, O, I, O, I, O, I, O, I, O, I,
            //                              I, O, I, O, I, O, I, O, I, O, I,
            //                              I, O, I, O, I, O, I, O, I, O, I,
            //                              I, O, I, I, I, O, I, O, I, O, I,
            //                              I, O, O, O, O, O, O, O, O, O, I,
            //                              I, I, I, I, I, I, I, I, I, I, I };
            //    //MessageBox.Show("Poprvý");
            //}

            int PoziceRadku = 2;
            int Radek = 2;
            int AktualniBod = 0;

            //MessageBox.Show("kreslím...");

           //vykreslení řádku
            for (int r = 0; r < PocetRadku; r++)
            {
               
                    //vykreslení bodů na řádek
                    for (int i = 0; i < PocetBodu; i++)
                    {
                        if (r < this._nastaveni.Length && i < this._nastaveni[r].Length)
                        {
                            if (this._nastaveni[r][i] == 'B')
                            {
                                surface.FillRectangle(ZapLed, PoziceRadku, Radek, 2, 2);
                            }
                            else if (this._nastaveni[r][i] == ' ')
                                surface.FillRectangle(VypLed, PoziceRadku, Radek, 2, 2);
                            else
                                throw new Exception("Neplatný identifikátor stavu LED diody!");
                        }
                        else surface.FillRectangle(VypLed, PoziceRadku, Radek, 2, 2);

                        AktualniBod++;
                        PoziceRadku += 4;
                    }
                
                PoziceRadku = 2;
                Radek += 4;
            }
        }

        private void DrawText()
        {
            //List<bool> zasobnik = new List<bool>();
            int l = 0; //řádek (v počtu bodových řádků)

            string[] vstup = this._text;

            string[] datatext = new string[7 * vstup.Length];

            for (int m = 0; m < vstup.Length; m++)
            {
                string text = vstup[m].ToUpper();
                //MessageBox.Show(text);

                if (vstup == null)
                {
                    this._zobrazeni = zobrazeni.Vychozi;
                    break;
                }

                if (text.Length < 1)
                {
                    datatext[0 + l] += " ";
                    datatext[1 + l] += " ";
                    datatext[2 + l] += " ";
                    datatext[3 + l] += " ";
                    datatext[4 + l] += " ";
                    datatext[5 + l] += " ";
                    datatext[6 + l] += " ";
                    //l += 7;
                }
                else
                {
                    

                    //vykreslení písmen
                    for (int i = 0; i < text.Length; i++)
                    {
                        char znak = text[i];

                        //Filtr písmen
                        switch (znak)
                        {
                            case 'A':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " BBBBB ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'B':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBB  ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " BBBB  ";
                                break;

                            case 'C':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " B     ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'D':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " BBBB  ";
                                break;

                            case 'E':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'F':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " B     ";
                                break;

                            case 'G':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " B BBB ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'H':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'I':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "   B   ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'J':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "     B ";
                                datatext[3 + l] += "     B ";
                                datatext[4 + l] += "     B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += "  BBB  ";
                                break;

                            case 'K':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " B  B  ";
                                datatext[4 + l] += " BBB   ";
                                datatext[5 + l] += " B  B  ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'L':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B     ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " B     ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'M':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " BB BB ";
                                datatext[4 + l] += " B B B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'N':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " BB  B ";
                                datatext[4 + l] += " B B B ";
                                datatext[5 + l] += " B  BB ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'O':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += "  BBB  ";
                                break;

                            case 'P':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBB  ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " B     ";
                                break;

                            case 'Q':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B B B ";
                                datatext[5 + l] += " B  B  ";
                                datatext[6 + l] += "  BB B ";
                                break;

                            case 'R':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBB  ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'S':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += "  BBB  ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += " BBBB  ";
                                break;

                            case 'T':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "   B   ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case 'U':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += "  BBB  ";
                                break;

                            case 'V':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += "  B B  ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case 'W':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " B B B ";
                                datatext[6 + l] += "  B B  ";
                                break;

                            case 'X':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += "  B B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "  B B  ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'Y':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += "  B B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case 'Z':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "    B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "  B    ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            /*
                             * DIAKRITIKA
                             */

                            case 'Ě':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'Š':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += "  BBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += "  BBB  ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += " BBBB  ";
                                break;

                            case 'Č':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " B     ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'Ř':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBB  ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'Ž':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "    B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "  B    ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'Ý':
                                datatext[0 + l] += "    B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += "  B B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case 'Á':
                                datatext[0 + l] += "    B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += "  BBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " BBBBB ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case 'Í':
                                datatext[0 + l] += "    B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "   B   ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'É':
                                datatext[0 + l] += "    B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case 'Ť':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "   B   ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case 'Ď':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " BBBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " B   B ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " BBBB  ";
                                break;

                            case 'Ň':
                                datatext[0 + l] += "  B B  ";
                                datatext[1 + l] += "   B   ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += " BB  B ";
                                datatext[4 + l] += " B B B ";
                                datatext[5 + l] += " B  BB ";
                                datatext[6 + l] += " B   B ";
                                break;

                            /*
                             * ČÍSELNÉ ZNAKY
                             */

                            case '0':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " BB  B ";
                                datatext[4 + l] += " B B B ";
                                datatext[5 + l] += " B  BB ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case '1':
                                datatext[0 + l] += "     ";
                                datatext[1 + l] += "     ";
                                datatext[2 + l] += "   B ";
                                datatext[3 + l] += "  BB ";
                                datatext[4 + l] += " B B ";
                                datatext[5 + l] += "   B ";
                                datatext[6 + l] += "   B ";
                                break;

                            case '2':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "     B ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B     ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case '3':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "     B ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case '4':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B     ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += "     B ";
                                break;

                            case '5':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case '6':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B     ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            case '7':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "     B ";
                                datatext[4 + l] += "    B  ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += "  B    ";
                                break;

                            case '8':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BBB  ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += "  BBB  ";
                                datatext[5 + l] += " B   B ";
                                datatext[6 + l] += "  BBB  ";
                                break;

                            case '9':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " B   B ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "     B ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            /*
                             * SPECIÁLNÍ ZNAKY
                             */

                            case '.':
                                datatext[0 + l] += "   ";
                                datatext[1 + l] += "   ";
                                datatext[2 + l] += "   ";
                                datatext[3 + l] += "   ";
                                datatext[4 + l] += "   ";
                                datatext[5 + l] += " BB";
                                datatext[6 + l] += " BB";
                                break;

                            case ',':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += "    ";
                                datatext[3 + l] += "    ";
                                datatext[4 + l] += "    ";
                                datatext[5 + l] += "  BB";
                                datatext[6 + l] += " BB ";
                                break;

                            case ';':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += "  BB";
                                datatext[3 + l] += "  BB";
                                datatext[4 + l] += "    ";
                                datatext[5 + l] += "  BB";
                                datatext[6 + l] += " BB ";
                                break;

                            case ':':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += " BB ";
                                datatext[3 + l] += " BB ";
                                datatext[4 + l] += "    ";
                                datatext[5 + l] += " BB ";
                                datatext[6 + l] += " BB ";
                                break;

                            case '!':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += " BB ";
                                datatext[3 + l] += " BB ";
                                datatext[4 + l] += " BB ";
                                datatext[5 + l] += "    ";
                                datatext[6 + l] += " BB ";
                                break;

                            case '?':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "  BB   ";
                                datatext[3 + l] += " B  B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "       ";
                                datatext[6 + l] += "   B   ";
                                break;

                            case '+':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += "    ";
                                datatext[3 + l] += "  B ";
                                datatext[4 + l] += " BBB";
                                datatext[5 + l] += "  B ";
                                datatext[6 + l] += "    ";
                                break;

                            case '-':
                                datatext[0 + l] += "    ";
                                datatext[1 + l] += "    ";
                                datatext[2 + l] += "    ";
                                datatext[3 + l] += "    ";
                                datatext[4 + l] += " BBB";
                                datatext[5 + l] += "    ";
                                datatext[6 + l] += "    ";
                                break;

                            case '*':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B   B ";
                                datatext[3 + l] += "  B B  ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "  B B  ";
                                datatext[6 + l] += " B   B ";
                                break;

                            case '/':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "     B ";
                                datatext[3 + l] += "    B  ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "  B    ";
                                datatext[6 + l] += " B     ";
                                break;

                            case '\\':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " B     ";
                                datatext[3 + l] += "  B    ";
                                datatext[4 + l] += "   B   ";
                                datatext[5 + l] += "    B  ";
                                datatext[6 + l] += "     B ";
                                break;

                            case '>':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BB    ";
                                datatext[3 + l] += "   BB  ";
                                datatext[4 + l] += "     B ";
                                datatext[5 + l] += "   BB  ";
                                datatext[6 + l] += " BB    ";
                                break;

                            case '<':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "    BB ";
                                datatext[3 + l] += "  BB   ";
                                datatext[4 + l] += " B     ";
                                datatext[5 + l] += "  BB   ";
                                datatext[6 + l] += "    BB ";
                                break;

                            case '=':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += "       ";
                                datatext[3 + l] += " BBBBB ";
                                datatext[4 + l] += "       ";
                                datatext[5 + l] += " BBBBB ";
                                datatext[6 + l] += "       ";
                                break;

                            case '(':
                                datatext[0 + l] += "     ";
                                datatext[1 + l] += "     ";
                                datatext[2 + l] += "  BB ";
                                datatext[3 + l] += " B   ";
                                datatext[4 + l] += " B   ";
                                datatext[5 + l] += " B   ";
                                datatext[6 + l] += "  BB ";
                                break;

                            case ')':
                                datatext[0 + l] += "     ";
                                datatext[1 + l] += "     ";
                                datatext[2 + l] += " BB  ";
                                datatext[3 + l] += "   B ";
                                datatext[4 + l] += "   B ";
                                datatext[5 + l] += "   B ";
                                datatext[6 + l] += " BB  ";
                                break;

                            //kurzor
                            case '◙':
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += " BBBBB ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += " BBBBB ";
                                datatext[6 + l] += " BBBBB ";
                                break;

                            //MEZERA
                            case ' ':
                                datatext[0 + l] += "     ";
                                datatext[1 + l] += "     ";
                                datatext[2 + l] += "     ";
                                datatext[3 + l] += "     ";
                                datatext[4 + l] += "     ";
                                datatext[5 + l] += "     ";
                                datatext[6 + l] += "     ";
                                break;

                            //znak neodpovídá žánému definovanému znaku
                            default:
                                datatext[0 + l] += "       ";
                                datatext[1 + l] += "       ";
                                datatext[2 + l] += " BBBBB ";
                                datatext[3 + l] += "   B   ";
                                datatext[4 + l] += " BBBBB ";
                                datatext[5 + l] += "   B   ";
                                datatext[6 + l] += " BBBBB ";
                                break;
                        }

                    }
                }
                l += 7;
            }
            this._nastaveni = datatext;
        }

        /// <summary>
        /// Vrátí počet bodů na LCD Displeji
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Vrátí počet bodů na LCD displeji")]
        public int PocetBodu
        {
            get { return this._pocetbodu; }
        }

        /// <summary>
        /// Nastaví, která LEDka bude na displeji svítit a která nebude.
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Nastaví, která LEDka bude na displeji svítit a která nebude.")]
        public string[] Nastaveni
        {
            get { return this._nastaveni; }
            set
            {
                this._nastaveni = value;
                this.Refresh();
            }
        }

        /// <summary>
        /// Přednastavené zobrazení obrazce na displeji.
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Přednastavené zobrazení obrazce na displeji.")]
        public zobrazeni Zobrazeni
        {
            set
            {
                this._zobrazeni = value;
                switch (this._zobrazeni)
                {

                    case zobrazeni.Vychozi:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] { "BBBBBBBBBBB",
                                                         "B         B",
                                                         "B BBB B B B",
                                                         "B B B B B B",
                                                         "B B B BB  B",
                                                         "B B B B B B",
                                                         "B B B B B B",
                                                         "B B B B B B",
                                                         "B BBB B B B",
                                                         "B         B",
                                                         "BBBBBBBBBBB" };
                        break;
                    case zobrazeni.Smajlik:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] { "           ",
                                                       "   BBBBB   ",
                                                       "  B     B  ",
                                                       " B BB BB B ",
                                                       " B BB BB B ",
                                                       " B       B ",
                                                       " B B   B B ",
                                                       " B  BBB  B ",
                                                       "  B     B  ",
                                                       "   BBBBB   ",
                                                       "           " };
                        break;
                    case zobrazeni.Srdce:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] { "  BB   BB  ",
                                                       " BBBB BBBB ",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       " BBBBBBBBB ",
                                                       "  BBBBBBB  ",
                                                       "   BBBBB   ",
                                                       "    BBB    ",
                                                       "     B     " };
                        break;
                    case zobrazeni.CheckIn:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] {"            ",
                                                      "            ",
                                                      "           B",
                                                      "          BB",
                                                      "         BB ",
                                                      "        BB  ",
                                                      "       BB   ",
                                                      " BB   BB    ",
                                                      "  BB BB     ",
                                                      "   BBB      ",
                                                      "    B       " };
                        break;
                    case zobrazeni.Fill:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] { "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB",
                                                       "BBBBBBBBBBB" };
                        break;
                    case zobrazeni.Dacan:
                        this._Sloupce = 40;
                        this._Radky = 11;

                        this._nastaveni = new string[] { "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                                         "B    BBBBB    BBB      BBB    BBB  BB  B",
                                                         "B     BBB      BB      BB      BB  BB  B",
                                                         "B  BB  BB  BB  BB  BB  BB  BB  BB   B  B",
                                                         "B  BB  BB  BB  BB  BBBBBB  BB  BB      B",
                                                         "B  BB  BB  BB  BB  BBBBBB  BB  BB  B   B",
                                                         "B  BB  BB      BB  BBBBBB      BB  BB  B",
                                                         "B  BB  BB      BB  BB  BB      BB  BB  B",
                                                         "B     BBB  BB  BB      BB  BB  BB  BB  B",
                                                         "B    BBBB  BB  BB      BB  BB  BB  BB  B",
                                                         "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB" };
                        //MessageBox.Show(this._nastaveni.Length.ToString());
                        break;
                    case zobrazeni.DacanII:
                        this._Sloupce = 40;
                        this._Radky = 11;

                        this._nastaveni = new string[] {  "                                        ",
                                                          " BBBB     BBBB   BBBBBB   BBBB   BB  BB ",
                                                          " BBBBB   BBBBBB  BBBBBB  BBBBBB  BB  BB ",
                                                          " BB  BB  BB  BB  BB  BB  BB  BB  BBB BB ",
                                                          " BB  BB  BB  BB  BB      BB  BB  BBBBBB ",
                                                          " BB  BB  BB  BB  BB      BB  BB  BB BBB ",
                                                          " BB  BB  BBBBBB  BB      BBBBBB  BB  BB ",
                                                          " BB  BB  BBBBBB  BB  BB  BBBBBB  BB  BB ",
                                                          " BBBBB   BB  BB  BBBBBB  BB  BB  BB  BB ",
                                                          " BBBB    BB  BB  BBBBBB  BB  BB  BB  BB ",
                                                                                               };
                        //MessageBox.Show(this._nastaveni.Length.ToString());
                        break;
                    case zobrazeni.SineWave:
                        this._Sloupce = 40;
                        this._Radky = 11;

                        this._nastaveni = new string[] {"   BB            BB            BB      ",
                                                        "  B  B          B  B          B  B     ",
                                                        " B    B        B    B        B    B     ",
                                                        " B    B        B    B        B    B     ",
                                                        "B      B      B      B      B      B    ",
                                                        "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                                        "       B      B      B      B      B    ",
                                                        "        B    B        B    B        B   ",
                                                        "        B    B        B    B        B   ",
                                                        "         B  B          B  B          B  ",
                                                        "          BB            BB            BB"};
                        //MessageBox.Show(this._nastaveni.Length.ToString());
                        break;
                    case zobrazeni.SquareWave:
                        this._Sloupce = 40;
                        this._Radky = 11;
                        this._nastaveni = new string[] { "BBBBB   BBBBB   BBBBB   BBBBB   BBBBB   ",
                                                         "B   B   B   B   B   B   B   B   B   B   ",
                                                         "B   B   B   B   B   B   B   B   B   B   ",
                                                         "B   B   B   B   B   B   B   B   B   B   ",
                                                         "B   B   B   B   B   B   B   B   B   B   ",
                                                         "BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB",
                                                         "    B   B   B   B   B   B   B   B   B   ",
                                                         "    B   B   B   B   B   B   B   B   B   ",
                                                         "    B   B   B   B   B   B   B   B   B   ",
                                                         "    B   B   B   B   B   B   B   B   B   ",
                                                         "    BBBBB   BBBBB   BBBBB   BBBBB   BBBB" };
                        //MessageBox.Show(this._nastaveni.Length.ToString());
                        break;
                    case zobrazeni.Ruka:
                        this._Sloupce = 11;
                        this._Radky = 11;
                        this._nastaveni = new string[] {"    B   B   ",
                                                        "   BBB BBB  ",
                                                        "   BBB BBB  ",
                                                        "   BBBBBBBB ",
                                                        " BBBBBBBBBB ",
                                                        "BBBBBBBBBBB ",
                                                        " BBBBBBBBB  ",
                                                        "   BBBBBBB  ",
                                                        "   BBBBBB   ",
                                                        "  BBBBBBB   ",
                                                        "  BBBBBBB   " };
                        //MessageBox.Show(this._nastaveni.Length.ToString());
                        break;

                    case zobrazeni.Text:
                        this.DrawText();
                        this.Refresh();
                        this.Invalidate();
                        break;
                }
                this.Refresh();
                this.Invalidate();
            }
            get { return this._zobrazeni; }
        }

        /// <summary>
        /// Vrátí počet sloupců na displeji
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Vrátí sloupců na displeji")]
        public int Sloupce
        {
            get
            {
                return this._Sloupce;
            }
            set
            {
                this._Sloupce = value;
                this.Refresh();
                this.Invalidate();
            }
        }

        /// <summary>
        /// Vrátí počet řádků na displeji
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Vrátí řádků na displeji")]
        public int Radky
        {
            get
            {
                return this._Radky;
            }
            set
            {
                this._Radky = value;
                this.Refresh();
                this.Invalidate();
            }
        }

        /// <summary>
        /// Barva rozsvícené LED
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Barva rozsvícené LED")]
        public Color BarvaZapLED
        {
            get
            {
                return this._BarvaZapLED.Color;
                
            }
            set
            {
                this._BarvaZapLED.Color = value;
                this.Refresh();
                this.Invalidate();
            }
        }

        /// <summary>
        /// Barva zhasnuté LED
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Barva zhasnuté LED")]
        public Color BarvaVypLED
        {
            get
            {
                return this._BarvaVypLed.Color;
            }
            set
            {
                this._BarvaVypLed.Color = value;
                this.Refresh();
                //this.Invalidate();
            }
        }

        /// <summary>
        /// Text, který se zobrazí na LCD displeji
        /// </summary>
        [Category("LCD"), Bindable(true), Description("Text, který se zobrazí na LCD displeji")]
        public string[] DisplayText
        {
            get
            {
                return this._text;
            }
            set
            {
                this._text = value;

                if(_zobrazeni == zobrazeni.Text)
                    this.DrawText();

                this.Refresh();
                this.Invalidate();
            }
        }
    }
}
