Exemplo n.º 1
0
        protected override void OnRefresh()
        {
            RectangleFill profileRectangle = Visual as RectangleFill;

            if (profileRectangle != null)
            {
                _fillBrush       = new SolidColorBrush(profileRectangle.FillColor);
                _imageRect.Width = profileRectangle.Width;
                if (profileRectangle.Inverse_direction != true)
                {
                    _imageRect.Y = profileRectangle.Height - (profileRectangle.Height * profileRectangle.FillHeight); // calculate the Y position of the rectangle to draw it from botton to top
                }
                _imageRect.Height = profileRectangle.Height * profileRectangle.FillHeight;

                if (profileRectangle.BorderThickness > 0d)
                {
                    _borderPen = new Pen(new SolidColorBrush(profileRectangle.BorderColor), profileRectangle.BorderThickness);
                }
                else
                {
                    _borderPen = null;
                }
            }
        }
Exemplo n.º 2
0
        protected override void OnRender(System.Windows.Media.DrawingContext drawingContext)
        {
            RectangleFill profileRectangle = Visual as RectangleFill;

            drawingContext.DrawRoundedRectangle(_fillBrush, _borderPen, _imageRect, profileRectangle.CornerRadius, profileRectangle.CornerRadius);
        }