/// <summary>
        ///     Chuyển số thập phân sang hỗn số và phân số khi người dùng nhập dữ liệu.
        /// </summary>
        private void TextChangeFrac_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (textChangeFrac.Text.Length > 0)
                {
                    if (!textChangeFrac.Text[textChangeFrac.Text.Length - 1].Equals('.'))
                    {
                        decimal num = decimal.Parse(textChangeFrac.Text);
                        cal.Reset();

                        int whole = cal.ChangeFraction(num);

                        MixedFraction mixed = new MixedFraction(cal.Result.Numerator, cal.Result.Denominator, whole == 0 ? 0 : whole);

                        wholeChangeFrac1.Text = mixed.Whole.ToString();
                        numChangeFrac1.Text   = mixed.Numerator.ToString();
                        demoChangeFrac1.Text  = mixed.Denominator.ToString();

                        mixed.Minimalism();

                        numChangeFrac2.Text  = mixed.Numerator.ToString();
                        demoChangeFrac2.Text = mixed.Denominator.ToString();
                    }
                }
                else
                {
                    cal.Reset();
                    wholeChangeFrac1.ResetText();
                    numChangeFrac1.ResetText();
                    demoChangeFrac1.ResetText();
                    numChangeFrac2.ResetText();
                    demoChangeFrac2.ResetText();
                }
            }
            catch (Exception err)
            {
                //MessageBox.Show(err.Message);
                wholeChangeFrac1.ResetText();
                numChangeFrac1.ResetText();
                demoChangeFrac1.ResetText();

                numChangeFrac2.ResetText();
                demoChangeFrac2.ResetText();
            }
        }
        /// <summary>
        ///     Tối giản phân số.
        /// </summary>
        private void TextMinimalism_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (!numMini.Text.Equals("") && !demoMini.Text.Equals("") && !wholeMini.Text.Equals(""))
                {
                    MixedFraction mixed = cal.ToMixedFraction(new Calculator(), Convert.ToDecimal(numMini.Text),
                                                              Convert.ToDecimal(demoMini.Text), Convert.ToDecimal(wholeMini.Text));

                    mixed.Minimalism();

                    numRsMini.Text  = mixed.Numerator.ToString();
                    demoRsMini.Text = mixed.Denominator.ToString();
                }
                else
                {
                    if (!numMini.Text.Equals("") && !demoMini.Text.Equals(""))
                    {
                        Fraction fraction = cal.ToFraction(new Calculator(), Convert.ToDecimal(numMini.Text), Convert.ToDecimal(demoMini.Text));
                        fraction.Minimalism();

                        numRsMini.Text  = fraction.Numerator.ToString();
                        demoRsMini.Text = fraction.Denominator.ToString();
                    }
                    else
                    {
                        numRsMini.ResetText();
                        demoRsMini.ResetText();
                    }
                }
            }
            catch (Exception err)
            {
                //MessageBox.Show(err.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                numRsMini.ResetText();
                demoRsMini.ResetText();
            }
        }
        /// <summary>
        ///     So sánh các phân số với nhau cho kết quả.
        /// </summary>
        private void TextCompare_TextChanged(object sender, EventArgs e)
        {
            try
            {
                if (!numCompare1.Text.Equals("") && !demoCompare1.Text.Equals("") && !wholeCompare1.Text.Equals("") &&
                    !numCompare2.Text.Equals("") && !demoCompare2.Text.Equals("") && !wholeCompare2.Text.Equals(""))
                {
                    //Dùng class calculator để xử lí
                    MixedFraction mix1 = cal.ToMixedFraction(new Calculator(), Convert.ToDecimal(numCompare1.Text),
                                                             Convert.ToDecimal(demoCompare1.Text), Convert.ToDecimal(wholeCompare1.Text));

                    MixedFraction mix2 = cal.ToMixedFraction(new Calculator(), Convert.ToDecimal(numCompare2.Text),
                                                             Convert.ToDecimal(demoCompare2.Text), Convert.ToDecimal(wholeCompare2.Text));

                    mix1.Minimalism();
                    mix2.Minimalism();

                    cal.Num1 = mix1;
                    cal.Num2 = mix2;

                    int result = cal.Compare();

                    switch (result)
                    {
                    case 0:
                        lbCompare.Text = "=";
                        break;

                    case 1:
                        lbCompare.Text = ">";
                        break;

                    case -1:
                        lbCompare.Text = "<";
                        break;

                    default:
                        lbCompare.Text = "?";
                        break;
                    }
                }
                else
                {
                    if (!numCompare1.Text.Equals("") && !demoCompare1.Text.Equals("") &&
                        !numCompare2.Text.Equals("") && !demoCompare2.Text.Equals(""))
                    {
                        //Dùng class calculator để xử lí
                        cal.Num1 = cal.ToFraction(new Calculator(), decimal.Parse(numCompare1.Text), decimal.Parse(demoCompare1.Text));
                        cal.Num2 = cal.ToFraction(new Calculator(), decimal.Parse(numCompare2.Text), decimal.Parse(demoCompare2.Text));

                        int result = cal.Compare();

                        switch (result)
                        {
                        case 0:
                            lbCompare.Text = "=";
                            break;

                        case 1:
                            lbCompare.Text = ">";
                            break;

                        case -1:
                            lbCompare.Text = "<";
                            break;

                        default:
                            lbCompare.Text = "?";
                            break;
                        }
                    }
                    else
                    {
                        lbCompare.Text = "?";
                    }
                }
            }
            catch (Exception err)
            {
                //MessageBox.Show(err.Message, "Lỗi", MessageBoxButtons.OK, MessageBoxIcon.Error);
                resultChangeNum.ResetText();
            }
        }
 public void Coppy(MixedFraction m)
 {
     base.Coppy(m);
     Whole = m.Whole;
 }