Пример #1
0
        private void bt_SpareMatr_Click(object sender, EventArgs e)
        {
            graphics.Clear(BackColor);
            graphics = pictureBox1.CreateGraphics();
            WinFormDrawer drawer1 = new WinFormDrawer(graphics, new Pen(Color.Red));

            drawer1.Frame = checkBox1.Checked;
            drawer        = drawer1;
            if ((last_f == "") || !(matrix.GetType() == typeof(SparseMatrix)))
            {
                matrix = new SparseMatrix(Convert.ToInt32(tb_Col.Text), Convert.ToInt32(tb_Row.Text));
                InitiatorMatrix.RandomMatr(matrix, Convert.ToInt32(tb_NoNull.Text), Convert.ToInt32(tb_MaxVal.Text));
                renumDecorator = new RenumDecorator(matrix);
                Dec            = renumDecorator;
                ICommand command = new InitMatrixCommand(matrix, drawer, Dec, graphics);
                command.Execute(ref matrix, ref drawer, ref Dec, ref graphics);
                position++;
                commands.Add(command);
                inits_comm_indx.Add(position);
            }
            else if (matrix.GetType() == typeof(SparseMatrix))
            {
                renumDecorator.Draw(drawer);
            }
            last_f = "bt_SpareMatr";
        }
Пример #2
0
        private void bt_Add_Sparse_Click(object sender, EventArgs e)
        {
            graphics.Clear(BackColor);
            graphics = pictureBox1.CreateGraphics();
            matrix   = new SparseMatrix(Convert.ToInt32(tb_Col.Text), Convert.ToInt32(tb_Row.Text));
            InitiatorMatrix.RandomMatr(matrix, Convert.ToInt32(tb_NoNull.Text), Convert.ToInt32(tb_MaxVal.Text));
            //gMatrix.SetMatrix(matrix);
            ICommand      command = new HGMAddCommand(matrix);
            WinFormDrawer drawer1 = new WinFormDrawer(graphics, new Pen(Color.Red));

            drawer1.Frame = checkBox1.Checked;
            drawer        = drawer1;
            matrix        = gMatrix;
            if (Dec != null)
            {
                Dec.Cancel();
            }
            command.Execute(ref matrix, ref drawer, ref Dec, ref graphics);
            position++;
            commands.Add(command);
            //inits_comm_indx.Add(position);
            last_f = "bt_Add_Sparse_Click";
        }