コード例 #1
0
        private void ChangeString(object sender, EventArgs e)
        {
            //Disable the enabled functions
            stsmChangeString.Enabled = btnChangeString.Enabled = false;
            btnReadMachine.Enabled   = false;

            //Enable the disabled functions
            txtInputString.Enabled = true;

            //Remove previous data
            header = new HeadComponent("-", new Point(0, 0), new Point(0, 0), Color.Transparent);
            txtInputString.Text = null;
            commonTape.Clear();

            //Update the simulator
            spcSimulate.Panel2.Refresh();
        }
コード例 #2
0
        private void ConstructTape()
        {
            //Initialize the starting point
            Point P = new Point(20, 30);

            //Create the read/write head
            header = new HeadComponent("R/W", new Point(P.X + 5, P.Y + 40), new Point(P.X + 10, P.Y + 70), Color.Red);

            //Create the memory field
            foreach (char c in txtInputString.Text)
            {
                commonTape.Add(new TapeComponent(c.ToString(), P, new Point(P.X + 20, P.Y + 30), Color.Black));
                P.X += 20;
            }

            //Draw the parts
            spcSimulate.Panel2.Refresh();
        }