示例#1
0
        public override void ControlPaint(object sender, PaintEventArgs p)
        {
            if (this.parent)
            {
                int   a, b, c, d;
                Point relpos = this.GetPosRelativeToParent();
                a = (this.x >= parent.x) ? this.x : parent.x;
                b = (this.y >= parent.y) ? this.y : parent.y;
                c = (this.x + this.width > parent.x + parent.width) ? parent.width - relpos.X : this.width;
                d = (this.y + this.height > parent.y + parent.height) ? parent.height - relpos.Y : this.height;
                p.Graphics.Clip = new Region(new Rectangle(a, b, c, d));
            }
            else
            {
                p.Graphics.Clip = new Region(new Rectangle(this.x, this.y, this.width, this.height));
            }

            // Draw the solid grey bg
            //p.Graphics.FillRectangle(bgBrush, this.x, this.y, this.width, this.height);
            Derma.DrawRoundedRectangle(p.Graphics, bgBrushPen, this.x, this.y, this.width, this.height, 4);
        }