private void buttonMultiplication_Click(object sender, EventArgs e) { Del_Re((GlobalsMatrix.RowA + GlobalsMatrix.ColB) * 2, (GlobalsMatrix.ColA + GlobalsMatrix.RowB) * 2); GlobalsMatrix.nhan(); MatrixName = "Re"; xuatRe(GlobalsMatrix.RowA, GlobalsMatrix.ColB); GlobalsMatrix.ghiketqua(GlobalsMatrix.Re, GlobalsMatrix.RowA, GlobalsMatrix.ColB, "text.txt"); }
private void buttonSubtraction_Click(object sender, EventArgs e) { Del_Re(GlobalsMatrix.RowA, GlobalsMatrix.ColA); GlobalsMatrix.tru(); MatrixName = "Re"; xuatRe(GlobalsMatrix.RowA, GlobalsMatrix.ColA); GlobalsMatrix.ghiketqua(GlobalsMatrix.Re, GlobalsMatrix.RowA, GlobalsMatrix.ColA, "text.txt"); }
private void buttonInverseB_Click(object sender, EventArgs e) { if ((GlobalsMatrix.RowB != GlobalsMatrix.RowB) || (GlobalsMatrix.MatrixDeterminantDown(GlobalsMatrix.B, GlobalsMatrix.RowB) == 0)) { MessageBox.Show("Khong the thuc hien phep tinh"); } else { GlobalsMatrix.MergeMatrix(GlobalsMatrix.B, GlobalsMatrix.RowB); xuatRe(GlobalsMatrix.RowB, GlobalsMatrix.ColB); } }
private void Add_Matrix() { try { Random rd = new Random(); if (MatrixName == "A") { Col = int.Parse(textBoxColA.Text); Row = int.Parse(textBoxRowA.Text); GlobalsMatrix.setRowMatrixA(Row); GlobalsMatrix.setColMatrixA(Col); } else if (MatrixName == "B") { Col = int.Parse(textBoxColB.Text); Row = int.Parse(textBoxRowB.Text); GlobalsMatrix.setRowMatrixB(Row); GlobalsMatrix.setColMatrixB(Col); } for (int i = 0; i < Row; i++) { FlowLayoutPanel pan = new FlowLayoutPanel(); pan.Name = MatrixName + i; pan.BackColor = System.Drawing.Color.Violet; pan.Size = new System.Drawing.Size(46 * Col, 43); for (int j = 0; j < Col; j++) { Button btn = new Button(); btn.Name = MatrixName + i + "_" + j; float t = rd.Next(0, 100); btn.Text = "" + t; if (MatrixName == "A") { GlobalsMatrix.setMatrixA(i, j, t); } else if (MatrixName == "B") { GlobalsMatrix.setMatrixB(i, j, t); } else { btn.Text = btn.Name; } btn.Size = new System.Drawing.Size(40, 40); btn.Click += btn_Click; pan.Controls.Add(btn); } pan.FlowDirection = FlowDirection.LeftToRight; if (MatrixName == "A") { flowLayoutPanel1.Controls.Add(pan); } else if (MatrixName == "B") { flowLayoutPanel2.Controls.Add(pan); } else { flowLayoutPanel3.Controls.Add(pan); } } } catch (Exception ex) { MessageBox.Show(ex.Message); } //tabControl2.FlowDirection = FlowDirection.TopDown; }
private void buttonTransposeB_Click(object sender, EventArgs e) { GlobalsMatrix.chuyenvi(GlobalsMatrix.RowB, GlobalsMatrix.ColB, GlobalsMatrix.B); xuatReTranpose(GlobalsMatrix.RowRe, GlobalsMatrix.ColRe); }
private void ButtonSetUpB_Click(object sender, EventArgs e) { MatrixName = "B"; Add_Matrix(); GlobalsMatrix.ghiketqua(GlobalsMatrix.B, GlobalsMatrix.RowB, GlobalsMatrix.ColB, "matrixB.txt"); }
private void ButtonSetUpA_Click(object sender, EventArgs e) { MatrixName = "A"; Add_Matrix(); GlobalsMatrix.ghiketqua(GlobalsMatrix.A, GlobalsMatrix.RowA, GlobalsMatrix.ColA, "matrixA.txt"); }