Example #1
0
    // Add missing controls
    private void addMissingHiControls()
    {
        LinkedList <HistoryItem> intermediateList = new LinkedList <HistoryItem>();
        int added = 0;

        lock (historyListLock)
        {
            added = Shared.history.Count - hiControls.Count;
            int counter = 0;
            foreach (HistoryItem hi in Shared.history)
            {
                if (counter >= added)
                {
                    break;
                }

                counter++;
                intermediateList.AddFirst(hi);
            }
        }

        foreach (HistoryItem hi in intermediateList)
        {
            CcHistoryItemContainer newHi = new CcHistoryItemContainer(hi)
            {
                Parent = this
            };

            Controls.Add(newHi);
            hiControls.AddFirst(newHi);
            Application.DoEvents();
        }

        if (added > 0)
        {
            //filterVisible("mix");
            ResizeComponents();
            GC.Collect();
        }

        //Shared.mainForm.Text = hiControls.Count.ToString();
    }
Example #2
0
    private void ResizeComponents()
    {
        if (Visible == false)
        {
            return;
        }

        // My solution to the Panel AutoScroll problem
        // Each time the AutoScrollPosition is not at (0,0) the size of the scroll margin
        // seems to increase by the same amount as the AutoScrollPosition value
        // Workaround forces AutoScrollPosition to (0,0) and after resizing the Panel
        // renews the AutoScrollPosition from the state obtained before the resize.
        Point scrollAuto = AutoScrollPosition;

        AutoScrollPosition = new Point(0, 0);
        SuspendLayout();

        int counter      = 0;
        int hiHeight     = 80;
        int hiWidth      = Width - 200;
        int hiLeft       = (Width - hiWidth) / 2;
        int bottomMargin = 30;

        ccSearchContainer.Top    = 50;
        ccSearchContainer.Left   = hiLeft;
        ccSearchContainer.Height = 60;
        ccSearchContainer.Width  = hiWidth;

        ccSearch.Left   = 32;
        ccSearch.Width  = ccSearchContainer.Width - (ccSearch.Left * 2);
        ccSearch.Height = ccSearchContainer.Height;
        ccSearch.Top    = (ccSearchContainer.Height - ccSearch.Height) / 2;

        int topPoint = ccSearchContainer.Top + ccSearchContainer.Height + bottomMargin; //50;

        CcHistoryItemContainer neki = null;

        foreach (CcHistoryItemContainer hi in hiControls)
        {
            neki = hi;
            if (hi.Visible)
            {
                hi.Top    = topPoint + ((hiHeight + bottomMargin) * counter);
                hi.Left   = hiLeft;
                hi.Width  = hiWidth;
                hi.Height = hiHeight;

                hi.ResizeComponents();

                counter++;

                Application.DoEvents();
            }
        }

        // Now how do I fit more controls into this panel
        // max 'height' is around 32k
        //Shared.mainForm.Text = (neki.Top + neki.Height).ToString();

        ResumeLayout();
        AutoScrollPosition = new Point(Math.Abs(scrollAuto.X), Math.Abs(scrollAuto.Y));
        //Shared.mainForm.Text = scrollAuto.X.ToString() + ";" + scrollAuto.Y.ToString();
    }