示例#1
0
        protected override void OnRender(IDrawingContext context, Rect bounds, double opacity)
        {
            base.OnRender(context, bounds, opacity);

            Border border = WpfElement as Border;

            DrawingStyle style = DrawingStyle.FromElement(this);

            style.CornerRadius    = border.CornerRadius;
            style.Fill            = border.Background;
            style.Stroke          = border.BorderBrush;
            style.StrokeThickness = border.BorderThickness;
            style.Opacity         = opacity;

            context.DrawRect(bounds, style);

            if (border.ClipToBounds)
            {
                context.ClipRect(bounds, border.CornerRadius);
            }
        }