コード例 #1
0
        public void Render(Gdi gMem, Rectangle rClip, int yListOffset)
        {
            // Pass the graphics objects to all UI elements
            for (int i = 0; i < _children.Count; i++)
            {
                UIElementBase element = _children[i];
                if (element.Visible)
                {
                    int y = -yListOffset;
                    if (!(Host is Form))
                    {
                        y += Host.Top;
                    }

                    Rectangle elementRect = new Rectangle(Host.Left + element.Left,
                                                          y + element.Top,
                                                          element.Width,
                                                          element.Height);

                    if (IsVisibleOnRect(elementRect, rClip))
                    {
                        element.Render(gMem, elementRect);
                    }
                }
            }
        }
コード例 #2
0
        //protected override void OnRender(Gdi graphics, Rectangle rect)
        //{
        //    //base.OnRender(graphics, rect);

        //    //// Draw a back color
        //    //if (this.BackgroundColor != null)
        //    //{
        //    //    //using (Brush brush = new SolidBrush(BackgroundColor))
        //    //    //{
        //    //    //     graphics.FillRectangle(brush, new Rectangle(this.Left, this.Top, this.Height, this.Width));
        //    //    //}
        //    //    graphics.FillRect(Rectangle, BackgroundColor);
        //    //}

        //    // Pass the graphics objects to all UI elements
        //    for (int i = 0; i < _children.Count; i++)
        //    {
        //        UIElementBase element = _children[i];
        //        if (element.Visible)
        //        {
        //            //int y = 0;
        //            //if (!(Host is Form))
        //            //{
        //            //    y += Host.Top;
        //            //}

        //            //Rectangle elementRect = new Rectangle(Host.Left + element.Left,
        //            //            y + element.Top,
        //            //            element.Width,
        //            //            element.Height);

        //            if (IsVisibleOnRect(element.Rectangle, rect))
        //            {
        //                //element.Render(graphics, elementRect);
        //                element.Render(graphics, element.Rectangle);
        //            }
        //        }
        //    }
        //}

        protected override void OnRender(Gdi graphics, Rectangle rect)
        {
            //base.OnRender(graphics, rect);

            //// Draw a back color
            //if (this.BackgroundColor != null)
            //{
            //    //using (Brush brush = new SolidBrush(BackgroundColor))
            //    //{
            //    //     graphics.FillRectangle(brush, new Rectangle(this.Left, this.Top, this.Height, this.Width));
            //    //}
            //    graphics.FillRect(Rectangle, BackgroundColor);
            //}

            // Pass the graphics objects to all UI elements
            if (!_layouted)
            {
                for (int i = 0; i < _children.Count; i++)
                {
                    UIElementBase element = _children[i];
                    if (element.Visible)
                    {
                        if (element.Rectangle.IntersectsWith(rect))
                        {
                            element.Render(graphics, element.Rectangle);
                        }
                    }
                }
            }
        }