Esempio n. 1
0
        public void SetPanelSize()
        {
            if (mbeComponent == null)
            {
                AutoScrollMinSize = new Size(1, 1);
                return;
            }

            MbeRect rc     = mbeComponent.OccupationRect();
            int     width  = ((-rc.L > rc.R ? -rc.L : rc.R) + 10000) * 2;
            int     height = ((-rc.B > rc.T ? -rc.B : rc.T) + 10000) * 2;


            //int wm = (rc.Width+40000) / 2;
            //int hm = (rc.Height+40000) / 2;
            //rc = new MbeRect(new Point(rc.L - wm, rc.T + hm), new Point(rc.R + wm, rc.B - hm));


            width  = (int)Math.Round(width / displayScale);
            height = (int)Math.Round(height / displayScale);

            AutoScrollMinSize = new Size(width, height);


            int scrollWidth = width - ClientSize.Width;

            if (scrollWidth < 0)
            {
                scrollWidth = 0;
            }

            int scrollHeight = height - ClientSize.Height;

            if (scrollHeight < 0)
            {
                scrollHeight = 0;
            }

            AutoScrollPosition = new Point(scrollWidth / 2, scrollHeight / 2);
        }