public CloseForm(MainMdiForm parent) { InitializeComponent(); this.label1.Font = new Font(parent.myFonts.Families[1], 20, FontStyle.Regular); this.yesButton.Font = new Font(parent.myFonts.Families[1], 16, FontStyle.Regular); this.noButton.Font = new Font(parent.myFonts.Families[1], 16, FontStyle.Regular); }
public MatrixOtherDetailsForm(MainMdiForm parent) { InitializeComponent(); foreach (Label label in this.Controls) { label.Font = new Font(parent.myFonts.Families[parent.myFontStyle], label.Font.Size); } this.rank.Text = parent.matrixRank(parent.mainMatrix, parent.size).ToString(); this.trace.Text = parent.matrixTrace(parent.mainMatrix, parent.size).ToString(); this.sum.Text = parent.matrixSum(parent.mainMatrix, parent.size).ToString(); this.determinant.Text = parent.determinant(parent.mainMatrix, parent.size).ToString(); }
private void determinantZero(MainMdiForm parent) { Label label = new Label(); label.Name = "noInvertedMatrix"; label.BackColor = Color.Transparent; label.AutoSize = false; label.TextAlign = ContentAlignment.MiddleCenter; label.Size = new Size(400, 320); label.Location = new Point(0, 0); label.Font = new Font(parent.myFonts.Families[3], 24); label.ForeColor = Color.Red; label.Text += "Wyznacznik równy 0, nie można wyznaczyć macierzy odwrotnej"; this.Controls.Add(label); }
private void setLabel(MainMdiForm parent, Label label, Color color) { label.Size = new Size(countLabels < parent.size + 2 || state != 0 ? labelWidth : labelWidth / 2, labelHeight - 5); label.Location = new Point(labelLeftMargin + (countLabels < oldCount ? labelWidth / 2 + labelLeftMargin : 0), countLabels++ *labelHeight + labelTopMargin); label.UseCompatibleTextRendering = true; label.Font = new Font(parent.myFonts.Families[parent.myFontStyle], 16); label.ForeColor = color; label.BackColor = Color.Transparent; this.Controls.Add(label); if (countLabels >= oldCount) { oldCount = countLabels; } }
private void setLabel(MainMdiForm parent, Label label, int r, int c) { int[] fontSizes = { 120, 46, 30, 22, 18, 15, 13, 11, 9, 8, 7, 6, 5, 4, 3, 2, 1 }; int cellHeight = (this.Height + parent.size) / parent.size; int cellWidth = (this.Width + parent.size) / parent.size; label.BorderStyle = BorderStyle.Fixed3D; label.Name = "value_" + r.ToString() + "_" + c.ToString(); label.UseCompatibleTextRendering = true; label.TextAlign = ContentAlignment.MiddleCenter; label.BackColor = Color.Transparent; label.AutoSize = false; label.Size = new Size(cellWidth, cellHeight); label.Location = new Point(c * cellWidth, r * cellHeight); label.Font = new Font(parent.myFonts.Families[parent.myFontStyle], fontSizes[parent.size - 1]); label.ForeColor = ((r + c + parent.count) % 2 == 0 ? Color.Gold : Color.White); this.Controls.Add(label); }
public InputMatrixForm(MainMdiForm parent, bool isLinearEquationsMode) { InitializeComponent(); this.parent = parent; this.mode = isLinearEquationsMode; if (isLinearEquationsMode) { this.Text = "Układ równań liniowych"; this.label.Text = "Niewiadomych:"; } else { this.Text = "Własności macierzy"; this.label.Text = "Wymiar macierzy:"; } this.label.Font = new Font(parent.myFonts.Families[parent.myFontStyle], 22); }
public ShowMatrixForm(MainMdiForm parent, int[,] matrix) { InitializeComponent(); parent.count = (++parent.count) % 2; if (matrix == null) { determinantZero(parent); } else { for (int r = 0; r < parent.size; r++) { for (int c = 0; c < parent.size; c++) { Label label = new Label(); label.Text = matrix[r, c].ToString(); setLabel(parent, label, r, c); } } } }
public LinearEquationsResultForm(MainMdiForm parent) { InitializeComponent(); for (int r = 0; r < parent.size; r++) { Label label = new Label(); label.Name = "value_" + r.ToString(); for (int c = 0; c < parent.size; c++) { label.Text += Math.Abs(parent.mainMatrix[r, c]).ToString() + (char)(97 + c); if (c < parent.size - 1) { if (parent.mainMatrix[r, c + 1] < 0) { label.Text += " - "; } else { label.Text += " + "; } } else { label.Text += " = "; } } label.Text += parent.mainMatrix[r, parent.size]; setLabel(parent, label, basicColor); } int determinant = Convert.ToInt32(parent.determinant(parent.mainMatrix, parent.size)); if ((this.mainDeterminant = determinant) == 0) { state = 1; } Label label1 = new Label(); label1.Name = "det"; label1.Text += "Det(macierz) = " + determinant; setLabel(parent, label1, secondColor); Label label2 = new Label(); label2.Name = "state0"; if (state == 0) { label2.Text += "Układ oznaczony [dokładnie jedno rozwiązanie]"; setLabel(parent, label2, successColor); } else { label2.Text += "Układ nie jest oznaczony [nieoznaczony lub sprzeczny]"; setLabel(parent, label2, faultColor); } for (int i = 0; i < parent.size; i++) { if ((determinant = Convert.ToInt32(parent.determinant(parent.matrixSwapColumn(parent.mainMatrix, parent.size, i), parent.size))) != 0 && state != 0) { state = 2; } else { determinants.Add(determinant); } Label label = new Label(); label.Name = "det_" + (char)(65 + i); label.Text += "Det" + (char)(65 + i) + "(macierz) = " + determinant; setLabel(parent, label, secondColor); } if (state != 0) { Label label3 = new Label(); label3.Name = "state1"; if (state == 2) { label3.Text += "Układ sprzeczny [nie posiada rozwiazań]"; } else { label3.Text += "Układ nieoznaczony [nieskończenie wiele rozwiazań]"; } setLabel(parent, label3, faultColor); } else { countLabels -= parent.size; for (int i = 0; i < parent.size; i++) { Label label3 = new Label(); label3.Name = "result_" + (char)(65 + i); label3.Text += (char)(97 + i) + " = " + Convert.ToDouble(determinants[i]) / mainDeterminant; setLabel(parent, label3, basicColor); } } this.Width = 2 * labelLeftMargin + labelWidth; this.Height = (countLabels + 1) * labelHeight + 2 * labelTopMargin; }