Beispiel #1
0
 /// <summary>
 /// Key up
 /// </summary>
 /// <param name="sender">Sender</param>
 /// <param name="args">Arguments</param>
 private void keyPress(object sender, KeyPressEventArgs args)
 {
     if (keySymbol != null)
     {
         MathSymbol sym = keySymbol.GetSymbol(args);
         if (sym == null)
         {
             return;
         }
         sym = Find(sym);
         if (sym == null)
         {
             return;
         }
         if (newCursor is MathSymbol)
         {
             MathSymbol ds = newCursor as MathSymbol;
             newCursor = MathSymbolDrawable.InsertObject(ds, sym) as IInsertedObject;
         }
         else if (newCursor is MathFormulaDrawable)
         {
             MathFormulaDrawable mf = newCursor as MathFormulaDrawable;
             newCursor = mf.InsertObject(sym) as IInsertedObject;
         }
         //newCursor = newCursor.InsertObject(movedSymbol);
         movedSymbol = null;
         DrawCursor();
         DrawFormulaOnComponent();
         oldCursor      = movedSymbol as IInsertedObject;
         control.Cursor = CURSOR_EDIT;
     }
 }
Beispiel #2
0
 /// <summary>
 /// Draws itself
 /// </summary>
 /// <param name="g">graphics for drawing</param>
 public void Draw(Graphics g)
 {
     for (int i = 0; i < Count; i++)
     {
         IDrawableSymbol sym = this[i] as IDrawableSymbol;
         MathSymbolDrawable.Draw(sym as MathSymbol, g);
     }
 }
Beispiel #3
0
 /// <summary>
 /// Gets the symbol for removing by mouse click
 /// </summary>
 /// <param name="p">the mouse position</param>
 /// <returns>the symbol for removing by mouse click</returns>
 public IDrawableSymbol GetRemovedSymbol(Point p)
 {
     for (int i = 0; i < Count; i++)
     {
         MathSymbol      symbol = this[i];
         IDrawableSymbol ret    = MathSymbolDrawable.GetRemovedSymbol(symbol, p);
         if (ret != null)
         {
             return(ret);
         }
     }
     return(null);
 }
Beispiel #4
0
        private void Set(int n, ref int k, ref IDrawableSymbol symbol, ref int y)
        {
            int x = 0;

            for (int i = k; i < k + n; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            y += symbol.PureDrawable.RectForShow.Height;
            k += n;
        }
Beispiel #5
0
 /// <summary>
 /// Gets object to insert
 /// </summary>
 /// <param name="p">position of the object</param>
 /// <returns>The object</returns>
 public IInsertedObject GetInsertedObject(Point p)
 {
     for (int i = 0; i < Count; i++)
     {
         MathSymbol      find = this[i];
         IInsertedObject obj  = MathSymbolDrawable.GetInsertedObject(find, p);
         if (obj != null)
         {
             return(obj);
         }
     }
     if (endRectangle.Contains(p))
     {
         return(this);
     }
     return(null);
 }
Beispiel #6
0
        /// <summary>
        /// Calculates relative rectangle with children
        /// </summary>
        public void CalculateFullRelativeRectangle()
        {
            MathSymbolDrawable.CalculateFullRelativeRectangle(this);
            CalculateRelativeRectangle();
            Rectangle rr = pDrawable.RelativeRectangle;
            int       w  = rr.Width;
            int       up = rr.Y;

            MathFormulaDrawable[] f = new MathFormulaDrawable[] {
                this[0] as MathFormulaDrawable,
                this[1] as MathFormulaDrawable,
                this[2] as MathFormulaDrawable
            };
            Rectangle r1 = f[0].FullRelativeRectangle;
            Rectangle r2 = f[1].FullRelativeRectangle;
            Rectangle r3 = f[2].FullRelativeRectangle;

            up = (r1.Y < r2.Y) ? r1.Y : r2.Y;
            up = (r3.Y < up) ? up : r3.Y;
            if (rr.Y < up)
            {
                up = rr.Y;
            }
            int a1 = Math.Abs(r1.Y);
            int a2 = r1.Height + r1.Y;

            down = (a1 > a2) ? a1 : a2;
            if (rr.Y < up)
            {
                up = rr.Y;
            }
            int wc = (int)PureDrawableSymbol.Graphics.MeasureString(" ,  , ", PureDrawableSymbol.FontsBold[level]).Width;

            h    = (int)((double)down / Math.Sin(40.0 * 3.1415926 / 180.0));
            warc = (int)((double)h * (1 - Math.Cos(40.0 * 3.1415926 / 180.0)));
            int wpow = 0, hpow = 0;

            pDrawable.FullRelativeRectangleX      = 0;
            pDrawable.FullRelativeRectangleY      = -down - hpow;
            pDrawable.FullRelativeRectangleWidth  = rr.Width + r1.Width + r2.Width + r3.Width + 6 * warc + 4 + wpow;
            pDrawable.FullRelativeRectangleHeight = 2 * down + hpow;
        }
Beispiel #7
0
 public Point GetChildPosition(int n)
 {
     return(MathSymbolDrawable.GetChildPosition(this, n));
 }
Beispiel #8
0
        /// <summary>
        /// Preparation
        /// </summary>
        /// <param name="sx">Variable symbols</param>
        /// <param name="n">Level</param>
        /// <param name="sSubscript">Subscripted symbols</param>
        /// <param name="symbols">Text symbols</param>
        public void Prepare(string sx, int n, string[,] sSubscript, string[] symbols)
        {
            int[] sizes = MathSymbolFactory.Sizes;
            this.sizes = sizes;
            BeforePrepare();
            string[] all = symbols;

            Hashtable table = new Hashtable();

            string[,] el = new string[, ] {
                { "=", "=" }, { "&", "AND" }, { "\u2216", "AND" }, { "\u2217", "OR" }, { "|", "OR" }, { "\u8835", "=>" }, { "l", "LIKE" }, { "p", "=>" },
                { "¬", "NOT" }, { "(", "(" }, { ".", "." }, { ":", ":" }, { "?", "?" }, { "<", "<" }, { ">", ">" }, { "+", "+" },
                { "-", "-" }, { "*", "*" }, { "=", "=" }, { "/", "/" }, { "﹪", "%" }, { "A", "atan2" }, { "'", "d/dt" }
            };
            for (int i = 0; i < el.GetLength(0); i++)
            {
                table[el[i, 0]] = el[i, 1];
            }
            // MathFormula.Resources = table;


            int sub = (sSubscript == null) ? 0 : sSubscript.GetLength(0);

            //BinaryFunctionSymbolDrawable.Prepare(sizes, g);
            if (all != null)
            {
                foreach (string str in all)
                {
                    foreach (char c in str)
                    {
                        performer.Add(new SimpleSymbolDrawable(
                                          new SimpleSymbol(c, 0x0, false, false)));
                    }
                }
            }

            string ss = sx;

            for (int i = 0; i < sub; i++)
            {
                performer.Add(new SubscriptedSymbolDrawable(new SubscriptedSymbol(sSubscript[i, 0], sSubscript[i, 1])));
            }
            for (int i = 0; i < ss.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(ss[i])));
            }
            string elem = "scletqabjkfgwo'\u2211\u03B4\u0442";

            for (int i = 0; i < elem.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(elem[i], false, (byte)4)));
            }
            string integerSym = "ABCDEFGHI";

            performer.Add(new BinaryFunctionSymbolDrawable(new BinaryFunctionSymbol('A', "atan2")));
            for (int i = 0; i < integerSym.Length; i++)
            {
                char c = integerSym[i];
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(c, (byte)4, false, ElementaryIntegerOperation.GetString(c))));
            }
            string numbers = "x0123456789ABCDEF";

            for (int i = 0; i < numbers.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(numbers[i], false, (byte)5)));
            }
            string binary = ".+-*×/﹪=><\u2264\u2265\u2260?:&|^\u2266\u2267\u2216\u2217\u8835l\u2270";

            //string[,] el = new string[,] {{"\u2216", "AND"}, {"\u2217", "OR"}};
            //string binary = ".+-*=><?:&|^\u2217l";
            for (int i = 0; i < binary.Length; i++)
            {
                performer.Add(new BinarySymbolDrawable(new BinarySymbol(binary[i])));
            }
            string unary = "¬~";

            for (int i = 0; i < unary.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(unary[i], false, (byte)4)));
            }
            performer.Add(new BracketsSymbolDrawable(new BracketsSymbol()));
            performer.Add(new AbsSymbolDrawable(new AbsSymbol()));
            performer.Add(new BinaryFunctionSymbolDrawable(new BinaryFunctionSymbol('2', "(,)")));
            performer.Add(new TernaryFunctionSymbolDrawable(new TernaryFunctionSymbol('3', "(,,)")));
            performer.Add(new RootSymbolDrawable(new RootSymbol()));
            performer.Add(new FractionSymbolDrawable(new FractionSymbol()));
            performer.Add(new BinarySymbolDrawable(MathSymbol.Bra as BinarySymbol));
            performer.Add(new SimpleSymbolDrawable(MathSymbol.Ket as SimpleSymbol));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('e')));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('%', (byte)FormulaConstants.Variable, true, "\u03c0")));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(true)));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(false)));
            for (int i = 0; i < n; i++)
            {
                performer.Add(new SeriesSymbolDrawable(new SeriesSymbol(i)));
            }
            List <string> ls = StaticExtensionFormulaEditor.AdditionalFormulas;

            foreach (string str in ls)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('@', 0x0, false, true, str)));
            }
            List <string> lp = StaticExtensionFormulaEditor.Properties;

            foreach (string str in lp)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('.', 0x0, true, false, str)));
            }
            int             x = 10, y = 10;
            int             bottom = 0;
            IDrawableSymbol symbol = null;
            int             ns     = 0;

            if (all != null)
            {
                foreach (string str in all)
                {
                    foreach (char c in str)
                    {
                        symbol = performer[ns];
                        Point p = new Point(x, y);
                        MathSymbolDrawable.SetComponentPosition(symbol, p);
                        symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth, (int)(1.5 * 20));
                        x += symbol.PureDrawable.RectForShow.Width;
                        ++ns;
                    }
                    bottom = y + symbol.PureDrawable.RectForShow.Height;
                    y      = bottom;
                    x      = 10;
                }
            }

            if (sub != 0)
            {
                for (int i = ns; i < sub + ns; i++)
                {
                    symbol = performer[i];
                    Point p = new Point(x, y);
                    MathSymbolDrawable.SetComponentPosition(symbol, p);
                    symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth, (int)(1.5 * 20));
                    x += symbol.PureDrawable.RectForShow.Width;
                }
                bottom = y + symbol.PureDrawable.RectForShow.Height;
                y      = bottom;
                x      = 10;
            }
            for (int i = sub + ns; i < sub + ns + ss.Length; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, 30, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            for (int i = ss.Length + ns + sub; i < ss.Length + elem.Length + 1 + sub + ns; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;

            for (int i = sub + ns + ss.Length + elem.Length + 1; i < sub + ns + ss.Length + elem.Length + integerSym.Length + 1; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }

            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            for (int i = sub + ns + ss.Length + elem.Length + integerSym.Length + 1;
                 i < sub + ns + ss.Length + elem.Length + numbers.Length + integerSym.Length + 1; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            int k = sub + ns + ss.Length +
                    elem.Length + numbers.Length + integerSym.Length + binary.Length + unary.Length + 13 + n;

            for (int i = sub + ns + ss.Length + elem.Length + integerSym.Length + numbers.Length + 1; i < k; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            x      = 10;
            y      = bottom;
            if (ls.Count > 0)
            {
                for (int i = k; i < k + ls.Count; i++)
                {
                    symbol = performer[i];
                    Point p = new Point(x, y);
                    MathSymbolDrawable.SetComponentPosition(symbol, p);
                    symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                    x += symbol.PureDrawable.RectForShow.Width;
                }
                bottom = y + symbol.PureDrawable.RectForShow.Height;
            }
            k     += ls.Count;
            x      = 10;
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            if (lp.Count > 0)
            {
                for (int i = k; i < k + lp.Count; i++)
                {
                    symbol = performer[i];
                    Point p = new Point(x, y);
                    MathSymbolDrawable.SetComponentPosition(symbol, p);
                    symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                    x += symbol.PureDrawable.RectForShow.Width;
                }
                bottom = y + symbol.PureDrawable.RectForShow.Height;
            }
            AfrerPrepare(bottom);
            Resize += OnResize;
        }
Beispiel #9
0
 /// <summary>
 /// The "on click" event handler
 /// </summary>
 /// <param name="sender">The sender</param>
 /// <param name="e">The event arguments</param>
 private void onMouseClicked(object sender, MouseEventArgs e)
 {
     translate(e);
     if (movedSymbol == null)
     {
         movedSymbol = newSymbol;
         if (movedSymbol != null)
         {
             if (movedSymbol is DateTimeSymbol)
             {
                 DateTimeSymbol dts = movedSymbol as DateTimeSymbol;
                 dts.DateTime = dateTime.DateTime;
             }
             IDrawableSymbol ds = movedSymbol as IDrawableSymbol;
             wImage         = ds.PureDrawable.SymbolImage.Width;
             hImage         = ds.PureDrawable.SymbolImage.Height;
             control.Cursor = CURSOR_MOVE;
             oldX           = imagePoint.X;
             oldY           = imagePoint.Y;
             DrawCursor();
             if (newCursor != null)
             {
                 DrawCursor(newCursor, true, true);
             }
         }
         if (newRemoveCursor != null)
         {
             MathSymbol s = (MathSymbol)newRemoveCursor;
             if (s.Contains(newCursor))
             {
                 newCursor = null;
                 oldCursor = null;
             }
             s.Remove();
             newRemoveCursor = null;
             oldRemoveCursor = null;
             DrawFormulaOnComponent();
         }
     }
     else
     {
         if (newCursor == null)
         {
             movedSymbol = null;
             DrawCursor();
             newCursor      = null;
             oldCursor      = null;
             control.Cursor = CURSOR_EDIT;
         }
         else
         {
             if (newCursor is MathSymbol)
             {
                 MathSymbol ds = newCursor as MathSymbol;
                 newCursor = MathSymbolDrawable.InsertObject(ds, movedSymbol) as IInsertedObject;
             }
             else if (newCursor is MathFormulaDrawable)
             {
                 MathFormulaDrawable mf = newCursor as MathFormulaDrawable;
                 newCursor = mf.InsertObject(movedSymbol) as IInsertedObject;
             }
             //newCursor = newCursor.InsertObject(movedSymbol);
             movedSymbol = null;
             DrawCursor();
             DrawFormulaOnComponent();
             oldCursor      = movedSymbol as IInsertedObject;
             control.Cursor = CURSOR_EDIT;
         }
     }
 }
Beispiel #10
0
        /// <summary>
        /// Preparation
        /// </summary>
        /// <param name="sx">Variable symbols</param>
        /// <param name="n">Level</param>
        /// <param name="sSubscript">Subscripted symbols</param>
        /// <param name="symbols">Text symbols</param>
        public void Prepare(string sx, int n, string[,] sSubscript, string[] symbols)

        {
            string[] all = symbols;

            Hashtable table = new Hashtable();

            string[,] el = new string[, ] {
                { "=", "=" }, { "&", "AND" }, { "\u2216", "AND" }, { "\u2217", "OR" }, { "|", "OR" }, { "\u8835", "=>" }, { "l", "LIKE" }, { "p", "=>" },
                { "¬", "NOT" }, { "(", "(" }, { ".", "." }, { ":", ":" }, { "?", "?" }, { "<", "<" }, { ">", ">" }, { "+", "+" },
                { "-", "-" }, { "*", "*" }, { "/", "/" }, { "﹪", "%" }, { "=", "=" }, { "A", "atan2" }, { "'", "d/dt" }
            };
            for (int i = 0; i < el.GetLength(0); i++)
            {
                table[el[i, 0]] = el[i, 1];
            }
            // MathFormula.Resources = table;


            int[] sizes = MathSymbolFactory.Sizes;
            int   sub   = (sSubscript == null) ? 0 : sSubscript.GetLength(0);
            MathFormulaDrawable formula = new MathFormulaDrawable(new MathFormula((byte)0, sizes), DrawableConverter.Object);
            Control             control = this;

            performer = new FormulaEditor.FormulaEditorPerformer(control, formula);
            Color[] cols = new Color[] { Color.FromArgb(216, 203, 187), Color.Black };
            performer.SetColors(cols[0], cols[1]);
            Graphics g = Graphics.FromHwnd(control.Handle);

            SimpleSymbolDrawable.Prepare(sizes, g);
            BracketsSymbolDrawable.Prepare(sizes, g);
            AbsSymbolDrawable.Prepare(sizes, g);
            if (all != null)
            {
                foreach (string str in all)
                {
                    foreach (char c in str)
                    {
                        performer.Add(new SimpleSymbolDrawable(
                                          new SimpleSymbol(c, 0x0, false, false)));
                    }
                }
            }

            string ss = sx;

            for (int i = 0; i < sub; i++)
            {
                performer.Add(new SubscriptedSymbolDrawable(new SubscriptedSymbol(sSubscript[i, 0], sSubscript[i, 1])));
            }
            for (int i = 0; i < ss.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(ss[i])));
            }
            string elem = "scletqabjkfgw'\u2211\u03B4\u0442";

            for (int i = 0; i < elem.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(elem[i], false, (byte)4)));
            }
            string integerSym = "ABCDEFGH";

            performer.Add(new BinaryFunctionSymbolDrawable(new BinaryFunctionSymbol('A', "atan2")));
            for (int i = 0; i < integerSym.Length; i++)
            {
                char c = integerSym[i];
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(c, (byte)4, false, ElementaryIntegerOperation.GetString(c))));
            }
            string numbers = "x0123456789ABCDEF";

            for (int i = 0; i < numbers.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(numbers[i], false, (byte)5)));
            }
            string binary = ".+-*×=><\u2264\u2265\u2260?:&|^\u2266\u2267\u2216\u2217\u8835l\u2270";

            //string[,] el = new string[,] {{"\u2216", "AND"}, {"\u2217", "OR"}};
            //string binary = ".+-*=><?:&|^\u2217l";
            for (int i = 0; i < binary.Length; i++)
            {
                performer.Add(new BinarySymbolDrawable(new BinarySymbol(binary[i])));
            }
            string unary = "¬~";

            for (int i = 0; i < unary.Length; i++)
            {
                performer.Add(new SimpleSymbolDrawable(new SimpleSymbol(unary[i], false, (byte)4)));
            }
            performer.Add(new BracketsSymbolDrawable(new BracketsSymbol()));
            performer.Add(new AbsSymbolDrawable(new AbsSymbol()));
            performer.Add(new RootSymbolDrawable(new RootSymbol()));
            performer.Add(new FractionSymbolDrawable(new FractionSymbol()));
            performer.Add(new BinarySymbolDrawable(MathSymbol.Bra as BinarySymbol));
            performer.Add(new SimpleSymbolDrawable(MathSymbol.Ket as SimpleSymbol));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('e')));
            performer.Add(new SimpleSymbolDrawable(new SimpleSymbol('%', (byte)FormulaConstants.Variable, true, "\u03c0")));
            for (int i = 0; i < n; i++)
            {
                performer.Add(new SeriesSymbolDrawable(new SeriesSymbol(i)));
            }
            int             x = 10, y = 10;
            int             bottom = 0;
            IDrawableSymbol symbol = null;
            int             ns     = 0;

            if (all != null)
            {
                foreach (string str in all)
                {
                    foreach (char c in str)
                    {
                        symbol = performer[ns];
                        Point p = new Point(x, y);
                        MathSymbolDrawable.SetComponentPosition(symbol, p);
                        symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth, (int)(1.5 * 20));
                        x += symbol.PureDrawable.RectForShow.Width;
                        ++ns;
                    }
                    bottom = y + symbol.PureDrawable.RectForShow.Height;
                    y      = bottom;
                    x      = 10;
                }
            }

            if (sub != 0)
            {
                for (int i = ns; i < sub + ns; i++)
                {
                    symbol = performer[i];
                    Point p = new Point(x, y);
                    MathSymbolDrawable.SetComponentPosition(symbol, p);
                    symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth, (int)(1.5 * 20));
                    x += symbol.PureDrawable.RectForShow.Width;
                }

                bottom = y + symbol.PureDrawable.RectForShow.Height;
                y      = bottom;
                x      = 10;
            }
            for (int i = sub + ns; i < sub + ns + ss.Length; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, 30, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }

            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            for (int i = ss.Length + ns + sub; i < ss.Length + elem.Length + 2 + sub + ns; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;

            for (int i = sub + ns + ss.Length + elem.Length + 1; i < sub + ns + ss.Length + elem.Length + integerSym.Length + 1; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }

            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            for (int i = sub + ns + ss.Length + elem.Length + integerSym.Length + 1;
                 i < sub + ns + ss.Length + elem.Length + numbers.Length + integerSym.Length + 2; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            y      = bottom;
            x      = 10;
            for (int i = sub + ns + ss.Length + elem.Length + integerSym.Length + numbers.Length + 1; i < sub + ns + ss.Length +
                 elem.Length + numbers.Length + integerSym.Length + binary.Length + unary.Length + 8 + n; i++)
            {
                symbol = performer[i];
                Point p = new Point(x, y);
                MathSymbolDrawable.SetComponentPosition(symbol, p);
                symbol.PureDrawable.RectForShow = new Rectangle(x, y, symbol.StandardWidth + 10, (int)(1.5 * 20));
                x += symbol.PureDrawable.RectForShow.Width;
            }
            bottom = y + symbol.PureDrawable.RectForShow.Height;
            Rectangle r = new Rectangle(80, bottom, 1100, control.Height - bottom - 20);

            performer.FormulaRectangle = r;
            Image back = new Bitmap(1200, r.Y + r.Height + 10);

            g = Graphics.FromImage(back);
            g.FillRectangle(new SolidBrush(Color.LightGray), 0, 0, back.Width, back.Height);
            g.DrawRectangle(new Pen(Color.Black), 0, 0, back.Width - 1, back.Height - 1);
            Font  f      = new Font("Serif", sizes[0], FontStyle.Bold | FontStyle.Italic);
            int   delta  = 15;
            Brush bBrush = new SolidBrush(Color.Black);

            g.DrawString("f = ", f, bBrush, 10, r.Y + r.Height / 2 + delta);
            g.Dispose();
            performer.Prepare(back);
            formula           = new MathFormulaDrawable(new MathFormula((byte)0, sizes), DrawableConverter.Object);
            performer.Formula = formula;
            performer.InitEventHandlers();
            performer.DrawFormula();
        }