Forex_Strategy_Builder.Journal_Bars.OnResize C# (CSharp) Method

OnResize() protected method

Set params on resize
protected OnResize ( EventArgs eventargs ) : void
eventargs System.EventArgs
return void
        protected override void OnResize(EventArgs eventargs)
        {
            base.OnResize(eventargs);

            if (ClientSize.Height > 2 * rowHeight)
            {
                rows = (ClientSize.Height - 2 * rowHeight) / rowHeight;
            }
            else
            {
                rows = 0;
            }

            if (ClientSize.Width - vScrollBar.Width - 2 * border <= aiColumnX[columns])
                aiColumnX.CopyTo(aiX, 0);
            else
            {   // Scales the columns position
                float scale = (float)(ClientSize.Width - vScrollBar.Width - 2 * border) / aiColumnX[columns];
                for (int i = 0; i <= columns; i++)
                    aiX[i] = (int)(aiColumnX[i] * scale);
            }

            if (ClientSize.Width - vScrollBar.Width - 2 * border < aiColumnX[columns])
            {
                hScrollBar.Visible = true;
                int poinShort = aiColumnX[columns] - ClientSize.Width + vScrollBar.Width + 2 * border;
                if (hScrollBar.Value > poinShort)
                    hScrollBar.Value = poinShort;
                hScrollBar.Maximum = poinShort + hScrollBar.LargeChange - 2;
            }
            else
            {
                hScrollBar.Value = 0;
                hScrollBar.Visible = false;
            }

            SetUpJournal();
            Invalidate();

            return;
        }