コード例 #1
0
 public string GetDisplayValue()
 {
     return(@"   \" + (HasSumX ? SumX.ToString() : string.Empty).PadLeft(3)
            + "\r\n"
            + (HasSumY ? SumY.ToString() : string.Empty).PadRight(3) + @"\");
 }
コード例 #2
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (readXaYaXbYb() == true)
            {
                SumX           = Alpha * X_a + Beta * X_b;
                SumY           = Alpha * Y_a + Beta * Y_b;
                groupBox3.Text = "Координаты вектора (a + b)";
                // вывод данных
                string solution;
                string task;
                string given;
                string search;
                task  = " Найдите координаты вектора: ";
                task += "$\\alpha\\vec{a}+\\beta\\vec{b}$, если $\\vec{a}\\{" + X_a.ToString() + ";" + Y_a.ToString() + "\\}; \\vec{b}\\{" + X_b.ToString() + ";" + Y_b.ToString() + "\\};\\\\ \\alpha= " + Alpha.ToString() + "; \\beta =" + Beta.ToString() + ";$";

                given = " $\\vec{a}\\{" + X_a.ToString() + ";" + Y_a.ToString() + "\\}; \\vec{b}\\{" + X_b.ToString() + ";" + Y_b.ToString() + "\\}; \\alpha= " + Alpha.ToString() + "; \\beta =" + Beta.ToString() + "$.";

                search = "$\\alpha\\vec{a}+\\beta\\vec{b}$";

                solution = "Так как $\\vec{a}\\{" + X_a.ToString() + "; " + Y_a.ToString() + "\\}, \\vec{b}\\{" + X_b.ToString() + "; " + Y_b.ToString() + "\\}:\\\\$";

                solution += "$\\alpha\\vec{a}=\\{" + X_a.ToString() + "\\cdot\\alpha; " + Y_a.ToString() + "\\cdot\\alpha\\}=\\{" + X_a.ToString() + "\\cdot" + Alpha.ToString() + "; " + Y_a.ToString() + "\\cdot" + Alpha.ToString() + "\\}= \\{" + (Alpha * X_a).ToString() + "; " + (Alpha * Y_a).ToString() + "\\}$;\\\\";

                solution += "$\\beta\\vec{b}=\\{" + X_b.ToString() + "\\cdot\\beta; " + Y_b.ToString() + "\\cdot\\beta\\}=\\{" + X_b.ToString() + "\\cdot" + Beta.ToString() + "; " + Y_b.ToString() + "\\cdot" + Beta.ToString() + "\\}= \\{" + (Beta * X_b).ToString() + "; " + (Beta * Y_b).ToString() + "\\}$;\\\\";

                solution += "$(\\alpha\\vec{a}+\\beta\\vec{b})\\{" + (Alpha * X_a).ToString() + "+" + (Beta * X_b).ToString() + "; " + (Alpha * Y_a).ToString() + "+" + (Beta * Y_b).ToString() + "\\}=(" + Alpha.ToString() + "\\vec{a}+" + Beta.ToString() + "\\vec{b})\\{" + SumX.ToString() + ";" + sumY.ToString() + "\\}$.";

                GeneratorTexText generator = new GeneratorTexText();
                generator.Finish(task, given, search, solution);
                CleanXY();
            }
        }