Пример #1
0
        //============================================================
        // <T>计算全局坐标。</T>
        //
        // @param scale 缩放
        // @return 全局坐标
        //============================================================
        public virtual SIntRectangle CalculateRange()
        {
            // 获得最大范围
            int width  = _size.Width;
            int height = _size.Height;

            if (HasComponment())
            {
                foreach (FRcComponent component in _components)
                {
                    FRcControl control = component as FRcControl;
                    if (control != null)
                    {
                        int right = control.Right;
                        if (right > width)
                        {
                            width = right;
                        }
                        int bottom = control.Bottom;
                        if (bottom > height)
                        {
                            height = bottom;
                        }
                    }
                }
            }
            return(new SIntRectangle(_location.X, _location.Y, width, height));
        }
Пример #2
0
        //============================================================
        // <T>计算全局坐标。</T>
        //
        // @param scale 缩放
        // @return 全局坐标
        //============================================================
        public virtual FIntPoint2 CalculatePosition()
        {
            FIntPoint2 point = new FIntPoint2();
            FRcObject  find  = this;

            while (find != null)
            {
                FRcControl control = find as FRcControl;
                if (control != null)
                {
                    point.Add(control.Location);
                }
                find = find.Parent;
            }
            return(point);
        }