コード例 #1
0
        protected override void OnLayout(EventArgs e)
        {
            base.OnLayout(e);

            focusPainter.LayoutFocusRectangle(CalculateRelativeElementRectangle());

            if (Resizable)
            {
                Size size = new Size(SIZERS_SIZE - penWidth, SIZERS_SIZE - penWidth);
                tlCorner = new Rectangle(new Point(0, 0), size);
                trCorner = new Rectangle(new Point(VirtualWidth - SIZERS_SIZE, 0), size);
                blCorner = new Rectangle(new Point(0, VirtualHeight - SIZERS_SIZE), size);
                brCorner = new Rectangle(new Point(VirtualWidth - SIZERS_SIZE, VirtualHeight - SIZERS_SIZE), size);

                if (AllowAspectRatioDistortion)
                {
                    topSide    = Utility.CenterInRectangle(size, new Rectangle(new Point(0, 0), new Size(VirtualWidth, SIZERS_SIZE)));
                    rightSide  = Utility.CenterInRectangle(size, new Rectangle(new Point(VirtualWidth - SIZERS_SIZE, 0), new Size(SIZERS_SIZE, VirtualHeight)));
                    bottomSide = Utility.CenterInRectangle(size, new Rectangle(new Point(0, VirtualHeight - SIZERS_SIZE), new Size(VirtualWidth, SIZERS_SIZE)));
                    leftSide   = Utility.CenterInRectangle(size, new Rectangle(new Point(0, 0), new Size(SIZERS_SIZE, VirtualHeight)));
                }
                else
                {
                    topSide    = Rectangle.Empty;
                    rightSide  = Rectangle.Empty;
                    bottomSide = Rectangle.Empty;
                    leftSide   = Rectangle.Empty;
                }
            }
        }
コード例 #2
0
        protected override void OnLayout(EventArgs e)
        {
            int       padding = ElementFocusPainter.TOTAL_FOCUS_PADDING;
            Rectangle relativeElementRectangle = new Rectangle(padding, padding, VirtualWidth - padding * 2, VirtualHeight - padding * 2);

            focusPainter.LayoutFocusRectangle(relativeElementRectangle);
        }