private void MultLabel(double a, double b) { Clear(); string temp = Calculation.Multiple(a, b); Calculation.PreSetupMult(a, b, out int a_int, out int b_int, out int count); int xsize = temp.ToString().Length; outputText2.Margin = new Thickness(145 - xsize * 2, 20, 0, 0); outputText2.Content = "X"; textBlock.Margin = new Thickness(145, 20, 0, 0); textBlock.TextAlignment = TextAlignment.Right; textBlock.Text = a.ToString() + Environment.NewLine; textBlock.Text += b.ToString() + Environment.NewLine; outputText4.Margin = new Thickness(145, 35, 0, 0); outputText4.Content = Calculation.AddSpace(temp.Length, "__") + "______"; for (int i = 0; i < Calculation.div_step.Count; i++) { textBlock.Text += Calculation.div_step[i] + Environment.NewLine; } outputText3.Margin = new Thickness(145, 35 + (Calculation.div_step.Count * 15), 0, 0); outputText3.Content = Calculation.AddSpace(temp.Length, "__") + "______"; textBlock.Text += " " + temp; }
private void PlusLabel(double a, double b) { Clear(); string a_s; string b_s; string temp = Calculation.Sum(a, b); Calculation.PreSetupDiv(a, b, out int a_int, out int b_int, out int count); int xsize = temp.ToString().Length; outputText2.Margin = new Thickness(145 - xsize * 2, 20, 0, 0); outputText2.Content = "+"; textBlock.Margin = new Thickness(145, 20, 0, 0); textBlock.TextAlignment = TextAlignment.Right; if (count == 0) { a_s = a_int.ToString(); b_s = b_int.ToString(); } else { a_s = a_int.ToString().Insert(a_int.ToString().Length - count, ","); b_s = b_int.ToString().Insert(b_int.ToString().Length - count, ","); } textBlock.Text = a_s + Environment.NewLine; textBlock.Text += b_s + Environment.NewLine; outputText4.Margin = new Thickness(145, 35, 0, 0); outputText4.Content = Calculation.AddSpace(temp.Length, "__") + ""; textBlock.Text += temp + ""; }
private void DivLabel(double a, double b) { Clear(); string temp = Calculation.Divide(a, b); Calculation.PreSetupDiv(a, b, out int a_int, out int b_int, out int count); int xsize = a_int.ToString().Length; outputText.Margin = new Thickness(155 - (xsize * 12), 20, 0, 0); outputText2.Margin = new Thickness(155, 20, 0, 0); outputText3.Margin = new Thickness(360, 20, 0, 0); outputText4.Margin = new Thickness(145, 20, 0, 0); outputText4.Content = Calculation.AddSpace(temp.Length, "___"); for (int i = 0; i < Calculation.div_result.Count; i++) { outputText3.Content += Calculation.div_result[i] + Environment.NewLine; } for (int i = 0; i < Calculation.div_step.Count; i++) { outputText.Content += Calculation.div_step[i] + Environment.NewLine; } outputText2.Content = "|" + b_int.ToString(); outputText2.Content += Environment.NewLine + "|" + temp; }