context: using System;
  using System.Drawing;
  using System.Collections;
  using System.ComponentModel;
  using System.Windows.Forms;
  using System.Data;
  using System.Text;
  using System.Text.RegularExpressions;
  using NCurveGram;
  
  namespace NFingers
  {
    public class FFingers: System.Windows.Forms.Form
    {
      public static Regex reProductVersion = new Regex(@"(\d+\.\d+.\d+).*", RegexOptions.Compiled);
      public static string strProductVersion = "";
  
      private CTeacher m_teacher = null;
      private bool m_bBadDeal = false;
      private string m_strBeforePauseMode;
      private string m_strPauseMode = "... PAUSED, press [Esc] ...";
      private Label m_lblFingerOn = null;
      private Label m_lblFingerTo = null;
      private Color m_clrFingerTo;
      private Color m_clrPrevShift;
      private Label m_lblPrevShift;
      private string m_strFingerOn;
      private string m_strFingerTo;
      
      private System.Windows.Forms.Panel panelKeypad;
      private System.Windows.Forms.TextBox txtTarget;
      private System.Windows.Forms.MenuItem menuFile;
      private System.Windows.Forms.MenuItem menuFile_Exit;
      private System.Windows.Forms.MainMenu mainMenu;
      private System.Windows.Forms.MenuItem menuView;
      private System.Windows.Forms.MenuItem menuView_Configure;
      private System.Windows.Forms.Label lblSpeed;
      private System.Windows.Forms.Label lblErrors;
      private System.Windows.Forms.Label lblLevelSpeedDown;
      private System.Windows.Forms.Label lblLevelSpeedUp;
      private System.Windows.Forms.Label lblLevelErrorDown;
      private System.Windows.Forms.Panel panelNumpad;
      private System.Windows.Forms.Label kEnt;
      private System.Windows.Forms.Label kLsh;
      private System.Windows.Forms.Label kLbs;
      private System.Windows.Forms.Label kSpace;
      private System.Windows.Forms.Label kRsh;
      private System.Windows.Forms.Label kRs;
      private System.Windows.Forms.Label kDot;
      private System.Windows.Forms.Label kCom;
      private System.Windows.Forms.Label kM;
      private System.Windows.Forms.Label kN;
      private System.Windows.Forms.Label kB;
      private System.Windows.Forms.Label kV;
      private System.Windows.Forms.Label kC;
      private System.Windows.Forms.Label kX;
      private System.Windows.Forms.Label kZ;
      private System.Windows.Forms.Label kRbs;
      private System.Windows.Forms.Label kAca;
      private System.Windows.Forms.Label kSmi;
      private System.Windows.Forms.Label kL;
      private System.Windows.Forms.Label kK;
      private System.Windows.Forms.Label kJ;
      private System.Windows.Forms.Label kH;
      private System.Windows.Forms.Label kG;
      private System.Windows.Forms.Label kF;
      private System.Windows.Forms.Label kD;
      private System.Windows.Forms.Label kS;
      private System.Windows.Forms.Label kA;
      private System.Windows.Forms.Label kCap;
      private System.Windows.Forms.Label kLsb;
      private System.Windows.Forms.Label kP;
      private System.Windows.Forms.Label kO;
      private System.Windows.Forms.Label kI;
      private System.Windows.Forms.Label kU;
      private System.Windows.Forms.Label kY;
      private System.Windows.Forms.Label kT;
      private System.Windows.Forms.Label kR;
      private System.Windows.Forms.Label kE;
      private System.Windows.Forms.Label kW;
      private System.Windows.Forms.Label kQ;
      private System.Windows.Forms.Label kTab;
      private System.Windows.Forms.Label kBsp;
      private System.Windows.Forms.Label kEqu;
      private System.Windows.Forms.Label kMin;
      private System.Windows.Forms.Label k0;
      private System.Windows.Forms.Label k9;
      private System.Windows.Forms.Label k8;
      private System.Windows.Forms.Label k7;
      private System.Windows.Forms.Label k6;
      private System.Windows.Forms.Label k5;
      private System.Windows.Forms.Label k4;
      private System.Windows.Forms.Label k3;
      private System.Windows.Forms.Label k2;
      private System.Windows.Forms.Label k1;
      private System.Windows.Forms.Label kAp;
      private System.Windows.Forms.Label nDot;
      private System.Windows.Forms.Label n2;
      private System.Windows.Forms.Label n0;
      private System.Windows.Forms.Label nEnt;
      private System.Windows.Forms.Label nPls;
      private System.Windows.Forms.Label n3;
      private System.Windows.Forms.Label n1;
      private System.Windows.Forms.Label n6;
      private System.Windows.Forms.Label n5;
      private System.Windows.Forms.Label n4;
      private System.Windows.Forms.Label n9;
      private System.Windows.Forms.Label n8;
      private System.Windows.Forms.Label n7;
      private System.Windows.Forms.Label nMin;
      private System.Windows.Forms.Label nMul;
      private System.Windows.Forms.Label nDiv;
      private System.Windows.Forms.Label nNumLock;
      private System.Windows.Forms.Label lblLevelError0;
      private System.Windows.Forms.Label kRsb;
      private System.Windows.Forms.ProgressBar pbLevel;
      private System.Windows.Forms.MenuItem menuLevel;
      private System.Windows.Forms.MenuItem menuAbout;
      private System.Windows.Forms.MenuItem menuLevel_Restart;
      private System.Windows.Forms.MenuItem menuLevel_Separator1;
      private CC_CurveGram m_cgError;
      private Label lblErrorTitle;
      private Label lblSpeedTitle;
      private CC_CurveGram m_cgSpeed;
      private Panel panelSpeed;
      private Panel panelError;
      private IContainer components;
  
      [STAThread]
      static void Main()
      {
        try
        {
          Application.EnableVisualStyles();
          FFingers.strProductVersion = Application.ProductName + " v"
            + FFingers.reProductVersion.Replace(Application.ProductVersion, "$1");
          Application.Run(new FFingers());
        }
  #if DEBUG
        catch (Exception xcp)
        {
          DEBUG.DUMP_EXCEPTION(xcp);
        }
  #else
        catch (Exception)
        {
          MessageBox.Show("Program terminated unexpectedly."
            + Environment.NewLine
            + "Please try to repair this installation."
            , "Fingers"
            , MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
        }
  #endif
      }
  
      public FFingers()
      {
        InitializeComponent();
        InitTask();
      }
  
      public void InitTask()
      {
        SConfig cfg;
        
        if (m_teacher == null)
        {
          cfg = CConfig.ReadConfig();
          cfg.eMode = EMode.Keypad;
        }
        else
        {
          cfg = m_teacher.Config;
        }
        m_teacher = new CTeacher(cfg);
  
        m_teacher.OnBadAnswer += new NFingers.CTeacher.OnBadAnswerDelegate(m_teacher_OnBadAnswer);
        m_teacher.OnGoodAnswer += new NFingers.CTeacher.OnGoodAnswerDelegate(m_teacher_OnGoodAnswer);
        m_teacher.OnNewLine += new NFingers.CTeacher.OnNewLineDelegate(m_teacher_OnNewLine);
        m_teacher.OnNewLevel += new NFingers.CTeacher.OnNewLevelDelegate(m_teacher_OnNewLevel);
  
        m_teacher.Init();
  
        if (0 == System.IO.Path.DirectorySeparatorChar.CompareTo('/'))
        { // lazy detection of "mono on linux"
          // looks like that boddy hides left part of the text if it not fitts into "some"
          // visible control area while text-align is centered, so make it Left permanently
          // for `EMode.Keypad` mode only
          if (cfg.eMode == EMode.Keypad)
          {
            txtTarget.TextAlign = System.Windows.Forms.HorizontalAlignment.Left;
          }
          else
          {
            txtTarget.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
          }
        }
  
        char chOnTarget;
        txtTarget.Text = m_teacher.RefreshTaskForward(out chOnTarget);
        Feedback(chOnTarget);
        txtTarget.Font = cfg.Font;
        txtTarget.BackColor = Color.White;
  
        lblSpeed.Text = "0";
        lblLevelSpeedDown.Text = cfg.LevelSpeedDown.ToString();
        lblLevelSpeedUp.Text = cfg.LevelSpeedUp.ToString();
        m_cgSpeed.Maximum = cfg.LevelSpeedUp;
        m_cgSpeed.Minimum = cfg.LevelSpeedDown;
        m_cgSpeed.Value = m_cgSpeed.Minimum;
        m_cgSpeed.AlarmConditionMin = m_cgSpeed.Minimum;
        m_cgSpeed.AlarmConditionMax = m_cgSpeed.Minimum;
        m_cgSpeed.EnableAlarmCondition = true;
  
        lblErrors.Text = "0";
        lblLevelErrorDown.Text = cfg.LevelErrorDown.ToString();
  
        m_cgError.Maximum = cfg.LevelErrorDown*10;
        m_cgError.Minimum = 0;
        m_cgError.Value = m_cgError.Minimum*10;
        m_cgError.AlarmConditionMin = m_cgError.Maximum;
        m_cgError.AlarmConditionMax = m_cgError.Maximum;
        m_cgError.EnableAlarmCondition = true;
  
        if (cfg.eMode == EMode.Keypad)
        {
          panelNumpad.Visible = false;
          panelKeypad.Visible = true;
          panelError.Location = new Point(panelError.Location.X, 230);
          panelSpeed.Location = new Point(panelSpeed.Location.X, 230);
        }
        else
        {
          panelNumpad.Visible = true;
          panelKeypad.Visible = false;
          panelError.Location = new Point(panelError.Location.X, 72);
          panelSpeed.Location = new Point(panelSpeed.Location.X, 72);
        }
        
        InitLevelSelectionMenu();
      }
      
      ///<summary>init menu of level selection</summary>
      private void InitLevelSelectionMenu()
      {
        // get first separator index
        int iSep = menuLevel.MenuItems.IndexOf(menuLevel_Separator1);
        // remove the rest
        //@note: assume that after `menuLevel_Separator1` are dinamic items only
        // `*.Count` is decreasing )
        while ( ((menuLevel.MenuItems.Count - 1) - iSep) > 0 )
        {
          menuLevel.MenuItems.RemoveAt(iSep + 1);
        }
        
        // append new ones to the end of submenu
        for (int c = 0; c < CLevels.LevelsCount; c++)
        {
          menuLevel.MenuItems.Add((c + 1).ToString()
            , new EventHandler(menuLevel_submenuItem_Click));
        }
      }
  
      /// <summary>
      /// Whent the control is activated, text is selected and/or carret at the end of selection
      /// Here the method to return the carret at the beginning, removing selection
      /// </summary>
      private void FFingers_Activated(object sender, System.EventArgs e)
      {
        txtTarget.Focus();            // set focus before initialization
        txtTarget.SelectionStart = 0;
        txtTarget.SelectionLength = 0;
        txtTarget.Select(0, 0);
        txtTarget.ScrollToCaret();
      }
  
      private void FFingers_Closing(object sender, System.ComponentModel.CancelEventArgs e)
      {
        CConfig.SaveConfig(m_teacher.Config);
      }
  
      protected override void Dispose(bool disposing)
      {
        if (disposing)
        {
          if (components != null)
          {
            components.Dispose();
          }
        }
        base.Dispose(disposing);
      }
  
      #region Windows Form Designer generated code
      /// <summary>
      /// Required method for Designer support - do not modify
      /// the contents of this method with the code editor.
      /// </summary>
      private void InitializeComponent()
      {
        this.components = new System.ComponentModel.Container();
        System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(FFingers));
        this.panelKeypad = new System.Windows.Forms.Panel();
        this.kEnt = new System.Windows.Forms.Label();
        this.kLsh = new System.Windows.Forms.Label();
        this.kLbs = new System.Windows.Forms.Label();
        this.kSpace = new System.Windows.Forms.Label();
        this.kRsh = new System.Windows.Forms.Label();
        this.kRs = new System.Windows.Forms.Label();
        this.kDot = new System.Windows.Forms.Label();
        this.kCom = new System.Windows.Forms.Label();
        this.kM = new System.Windows.Forms.Label();
        this.kN = new System.Windows.Forms.Label();
        this.kB = new System.Windows.Forms.Label();
        this.kV = new System.Windows.Forms.Label();
        this.kC = new System.Windows.Forms.Label();
        this.kX = new System.Windows.Forms.Label();
        this.kZ = new System.Windows.Forms.Label();
        this.kRbs = new System.Windows.Forms.Label();
        this.kAca = new System.Windows.Forms.Label();
        this.kSmi = new System.Windows.Forms.Label();
        this.kL = new System.Windows.Forms.Label();
        this.kK = new System.Windows.Forms.Label();
        this.kJ = new System.Windows.Forms.Label();
        this.kH = new System.Windows.Forms.Label();
        this.kG = new System.Windows.Forms.Label();
        this.kF = new System.Windows.Forms.Label();
        this.kD = new System.Windows.Forms.Label();
        this.kS = new System.Windows.Forms.Label();
        this.kA = new System.Windows.Forms.Label();
        this.kCap = new System.Windows.Forms.Label();
        this.kRsb = new System.Windows.Forms.Label();
        this.kLsb = new System.Windows.Forms.Label();
        this.kP = new System.Windows.Forms.Label();
        this.kO = new System.Windows.Forms.Label();
        this.kI = new System.Windows.Forms.Label();
        this.kU = new System.Windows.Forms.Label();
        this.kY = new System.Windows.Forms.Label();
        this.kT = new System.Windows.Forms.Label();
        this.kR = new System.Windows.Forms.Label();
        this.kE = new System.Windows.Forms.Label();
        this.kW = new System.Windows.Forms.Label();
        this.kQ = new System.Windows.Forms.Label();
        this.kTab = new System.Windows.Forms.Label();
        this.kBsp = new System.Windows.Forms.Label();
        this.kEqu = new System.Windows.Forms.Label();
        this.kMin = new System.Windows.Forms.Label();
        this.k0 = new System.Windows.Forms.Label();
        this.k9 = new System.Windows.Forms.Label();
        this.k8 = new System.Windows.Forms.Label();
        this.k7 = new System.Windows.Forms.Label();
        this.k6 = new System.Windows.Forms.Label();
        this.k5 = new System.Windows.Forms.Label();
        this.k4 = new System.Windows.Forms.Label();
        this.k3 = new System.Windows.Forms.Label();
        this.k2 = new System.Windows.Forms.Label();
        this.k1 = new System.Windows.Forms.Label();
        this.kAp = new System.Windows.Forms.Label();
        this.lblLevelSpeedDown = new System.Windows.Forms.Label();
        this.lblLevelSpeedUp = new System.Windows.Forms.Label();
        this.lblSpeed = new System.Windows.Forms.Label();
        this.lblSpeedTitle = new System.Windows.Forms.Label();
        this.lblLevelErrorDown = new System.Windows.Forms.Label();
        this.lblErrors = new System.Windows.Forms.Label();
        this.lblErrorTitle = new System.Windows.Forms.Label();
        this.lblLevelError0 = new System.Windows.Forms.Label();
        this.txtTarget = new System.Windows.Forms.TextBox();
        this.mainMenu = new System.Windows.Forms.MainMenu(this.components);
        this.menuFile = new System.Windows.Forms.MenuItem();
        this.menuFile_Exit = new System.Windows.Forms.MenuItem();
        this.menuView = new System.Windows.Forms.MenuItem();
        this.menuView_Configure = new System.Windows.Forms.MenuItem();
        this.menuLevel = new System.Windows.Forms.MenuItem();
        this.menuLevel_Restart = new System.Windows.Forms.MenuItem();
        this.menuLevel_Separator1 = new System.Windows.Forms.MenuItem();
        this.menuAbout = new System.Windows.Forms.MenuItem();
        this.panelNumpad = new System.Windows.Forms.Panel();
        this.nDot = new System.Windows.Forms.Label();
        this.n2 = new System.Windows.Forms.Label();
        this.n0 = new System.Windows.Forms.Label();
        this.nEnt = new System.Windows.Forms.Label();
        this.nPls = new System.Windows.Forms.Label();
        this.n3 = new System.Windows.Forms.Label();
        this.n1 = new System.Windows.Forms.Label();
        this.n6 = new System.Windows.Forms.Label();
        this.n5 = new System.Windows.Forms.Label();
        this.n4 = new System.Windows.Forms.Label();
        this.n9 = new System.Windows.Forms.Label();
        this.n8 = new System.Windows.Forms.Label();
        this.n7 = new System.Windows.Forms.Label();
        this.nMin = new System.Windows.Forms.Label();
        this.nMul = new System.Windows.Forms.Label();
        this.nDiv = new System.Windows.Forms.Label();
        this.nNumLock = new System.Windows.Forms.Label();
        this.pbLevel = new System.Windows.Forms.ProgressBar();
        this.panelSpeed = new System.Windows.Forms.Panel();
        this.m_cgSpeed = new NCurveGram.CC_CurveGram();
        this.panelError = new System.Windows.Forms.Panel();
        this.m_cgError = new NCurveGram.CC_CurveGram();
        this.panelKeypad.SuspendLayout();
        this.panelNumpad.SuspendLayout();
        this.panelSpeed.SuspendLayout();
        this.panelError.SuspendLayout();
        this.SuspendLayout();
        // 
        // panelKeypad
        // 
        this.panelKeypad.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
                    | System.Windows.Forms.AnchorStyles.Right)));
        this.panelKeypad.Controls.Add(this.kEnt);
        this.panelKeypad.Controls.Add(this.kLsh);
        this.panelKeypad.Controls.Add(this.kLbs);
        this.panelKeypad.Controls.Add(this.kSpace);
        this.panelKeypad.Controls.Add(this.kRsh);
        this.panelKeypad.Controls.Add(this.kRs);
        this.panelKeypad.Controls.Add(this.kDot);
        this.panelKeypad.Controls.Add(this.kCom);
        this.panelKeypad.Controls.Add(this.kM);
        this.panelKeypad.Controls.Add(this.kN);
        this.panelKeypad.Controls.Add(this.kB);
        this.panelKeypad.Controls.Add(this.kV);
        this.panelKeypad.Controls.Add(this.kC);
        this.panelKeypad.Controls.Add(this.kX);
        this.panelKeypad.Controls.Add(this.kZ);
        this.panelKeypad.Controls.Add(this.kRbs);
        this.panelKeypad.Controls.Add(this.kAca);
        this.panelKeypad.Controls.Add(this.kSmi);
        this.panelKeypad.Controls.Add(this.kL);
        this.panelKeypad.Controls.Add(this.kK);
        this.panelKeypad.Controls.Add(this.kJ);
        this.panelKeypad.Controls.Add(this.kH);
        this.panelKeypad.Controls.Add(this.kG);
        this.panelKeypad.Controls.Add(this.kF);
        this.panelKeypad.Controls.Add(this.kD);
        this.panelKeypad.Controls.Add(this.kS);
        this.panelKeypad.Controls.Add(this.kA);
        this.panelKeypad.Controls.Add(this.kCap);
        this.panelKeypad.Controls.Add(this.kRsb);
        this.panelKeypad.Controls.Add(this.kLsb);
        this.panelKeypad.Controls.Add(this.kP);
        this.panelKeypad.Controls.Add(this.kO);
        this.panelKeypad.Controls.Add(this.kI);
        this.panelKeypad.Controls.Add(this.kU);
        this.panelKeypad.Controls.Add(this.kY);
        this.panelKeypad.Controls.Add(this.kT);
        this.panelKeypad.Controls.Add(this.kR);
        this.panelKeypad.Controls.Add(this.kE);
        this.panelKeypad.Controls.Add(this.kW);
        this.panelKeypad.Controls.Add(this.kQ);
        this.panelKeypad.Controls.Add(this.kTab);
        this.panelKeypad.Controls.Add(this.kBsp);
        this.panelKeypad.Controls.Add(this.kEqu);
        this.panelKeypad.Controls.Add(this.kMin);
        this.panelKeypad.Controls.Add(this.k0);
        this.panelKeypad.Controls.Add(this.k9);
        this.panelKeypad.Controls.Add(this.k8);
        this.panelKeypad.Controls.Add(this.k7);
        this.panelKeypad.Controls.Add(this.k6);
        this.panelKeypad.Controls.Add(this.k5);
        this.panelKeypad.Controls.Add(this.k4);
        this.panelKeypad.Controls.Add(this.k3);
        this.panelKeypad.Controls.Add(this.k2);
        this.panelKeypad.Controls.Add(this.k1);
        this.panelKeypad.Controls.Add(this.kAp);
        this.panelKeypad.Location = new System.Drawing.Point(8, 72);
        this.panelKeypad.Name = "panelKeypad";
        this.panelKeypad.Size = new System.Drawing.Size(616, 229);
        this.panelKeypad.TabIndex = 0;
        // 
        // kEnt
        // 
        this.kEnt.BackColor = System.Drawing.Color.Black;
        this.kEnt.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kEnt.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kEnt.ForeColor = System.Drawing.Color.White;
        this.kEnt.Location = new System.Drawing.Point(564, 40);
        this.kEnt.Name = "kEnt";
        this.kEnt.Size = new System.Drawing.Size(40, 76);
        this.kEnt.TabIndex = 54;
        this.kEnt.Text = "E";
        this.kEnt.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kLsh
        // 
        this.kLsh.BackColor = System.Drawing.Color.Black;
        this.kLsh.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kLsh.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kLsh.ForeColor = System.Drawing.Color.White;
        this.kLsh.Location = new System.Drawing.Point(12, 120);
        this.kLsh.Name = "kLsh";
        this.kLsh.Size = new System.Drawing.Size(40, 36);
        this.kLsh.TabIndex = 53;
        this.kLsh.Text = "Sh";
        this.kLsh.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kLbs
        // 
        this.kLbs.BackColor = System.Drawing.Color.Black;
        this.kLbs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kLbs.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kLbs.ForeColor = System.Drawing.Color.White;
        this.kLbs.Location = new System.Drawing.Point(60, 120);
        this.kLbs.Name = "kLbs";
        this.kLbs.Size = new System.Drawing.Size(36, 36);
        this.kLbs.TabIndex = 52;
        this.kLbs.Text = "\\";
        this.kLbs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kSpace
        // 
        this.kSpace.BackColor = System.Drawing.Color.Black;
        this.kSpace.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kSpace.Font = new System.Drawing.Font("Arial", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kSpace.ForeColor = System.Drawing.Color.White;
        this.kSpace.Location = new System.Drawing.Point(178, 160);
        this.kSpace.Name = "kSpace";
        this.kSpace.Size = new System.Drawing.Size(228, 32);
        this.kSpace.TabIndex = 51;
        this.kSpace.Text = " spacebar";
        this.kSpace.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kRsh
        // 
        this.kRsh.BackColor = System.Drawing.Color.Black;
        this.kRsh.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kRsh.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kRsh.ForeColor = System.Drawing.Color.White;
        this.kRsh.Location = new System.Drawing.Point(500, 120);
        this.kRsh.Name = "kRsh";
        this.kRsh.Size = new System.Drawing.Size(104, 36);
        this.kRsh.TabIndex = 50;
        this.kRsh.Text = "Sh";
        this.kRsh.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kRs
        // 
        this.kRs.BackColor = System.Drawing.Color.Black;
        this.kRs.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kRs.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kRs.ForeColor = System.Drawing.Color.White;
        this.kRs.Location = new System.Drawing.Point(460, 120);
        this.kRs.Name = "kRs";
        this.kRs.Size = new System.Drawing.Size(36, 36);
        this.kRs.TabIndex = 49;
        this.kRs.Text = "/";
        this.kRs.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kDot
        // 
        this.kDot.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
        this.kDot.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kDot.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kDot.ForeColor = System.Drawing.Color.White;
        this.kDot.Location = new System.Drawing.Point(420, 120);
        this.kDot.Name = "kDot";
        this.kDot.Size = new System.Drawing.Size(36, 36);
        this.kDot.TabIndex = 48;
        this.kDot.Text = ".";
        this.kDot.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kCom
        // 
        this.kCom.BackColor = System.Drawing.Color.Gray;
        this.kCom.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kCom.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kCom.ForeColor = System.Drawing.Color.White;
        this.kCom.Location = new System.Drawing.Point(380, 120);
        this.kCom.Name = "kCom";
        this.kCom.Size = new System.Drawing.Size(36, 36);
        this.kCom.TabIndex = 47;
        this.kCom.Text = ",";
        this.kCom.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kM
        // 
        this.kM.BackColor = System.Drawing.Color.Black;
        this.kM.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kM.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kM.ForeColor = System.Drawing.Color.White;
        this.kM.Location = new System.Drawing.Point(340, 120);
        this.kM.Name = "kM";
        this.kM.Size = new System.Drawing.Size(36, 36);
        this.kM.TabIndex = 46;
        this.kM.Text = "M";
        this.kM.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kN
        // 
        this.kN.BackColor = System.Drawing.Color.Black;
        this.kN.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kN.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kN.ForeColor = System.Drawing.Color.White;
        this.kN.Location = new System.Drawing.Point(300, 120);
        this.kN.Name = "kN";
        this.kN.Size = new System.Drawing.Size(36, 36);
        this.kN.TabIndex = 45;
        this.kN.Text = "N";
        this.kN.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kB
        // 
        this.kB.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
        this.kB.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kB.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kB.ForeColor = System.Drawing.Color.White;
        this.kB.Location = new System.Drawing.Point(260, 120);
        this.kB.Name = "kB";
        this.kB.Size = new System.Drawing.Size(36, 36);
        this.kB.TabIndex = 44;
        this.kB.Text = "B";
        this.kB.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kV
        // 
        this.kV.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
        this.kV.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kV.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kV.ForeColor = System.Drawing.Color.White;
        this.kV.Location = new System.Drawing.Point(220, 120);
        this.kV.Name = "kV";
        this.kV.Size = new System.Drawing.Size(36, 36);
        this.kV.TabIndex = 43;
        this.kV.Text = "V";
        this.kV.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kC
        // 
        this.kC.BackColor = System.Drawing.Color.Gray;
        this.kC.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kC.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kC.ForeColor = System.Drawing.Color.White;
        this.kC.Location = new System.Drawing.Point(180, 120);
        this.kC.Name = "kC";
        this.kC.Size = new System.Drawing.Size(36, 36);
        this.kC.TabIndex = 42;
        this.kC.Text = "C";
        this.kC.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kX
        // 
        this.kX.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(64)))), ((int)(((byte)(64)))), ((int)(((byte)(64)))));
        this.kX.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kX.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kX.ForeColor = System.Drawing.Color.White;
        this.kX.Location = new System.Drawing.Point(140, 120);
        this.kX.Name = "kX";
        this.kX.Size = new System.Drawing.Size(36, 36);
        this.kX.TabIndex = 41;
        this.kX.Text = "X";
        this.kX.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
        // 
        // kZ
        // 
        this.kZ.BackColor = System.Drawing.Color.Black;
        this.kZ.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
        this.kZ.Font = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
        this.kZ.ForeColor = System.Drawing.Color.White;
  
gt:       this.kZ.Location = new System.Drawing.Point(100, 120);