Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- protected override void OnRender(DrawingContext drawingContext)
- {
- if (this.Margin == WindowsUtilities.ZeroThickness)
- {
- return;
- }
- // Draw background.
- var backgroundRect = new Rect(this.Margin.Left, this.Margin.Top,
- this.ActualWidth - this.Margin.Left - this.Margin.Right,
- this.ActualHeight - this.Margin.Top - this.Margin.Bottom
- );
- // Draw border shadows.
- var leftRect = new Rect(0, this.Margin.Top,
- this.Margin.Left, this.ActualHeight - this.Margin.Top - this.Margin.Bottom
- );
- drawingContext.DrawRectangle(leftBrush, null, leftRect);
- var topRect = new Rect(this.Margin.Left, 0,
- this.ActualWidth - this.Margin.Left - this.Margin.Right, this.Margin.Top
- );
- drawingContext.DrawRectangle(topBrush, null, topRect);
- var rightRect = new Rect(this.ActualWidth - this.Margin.Right,
- this.Margin.Top, this.Margin.Right,
- this.ActualHeight - this.Margin.Top - this.Margin.Bottom
- );
- drawingContext.DrawRectangle(rightBrush, null, rightRect);
- var bottomRect = new Rect(this.Margin.Left,
- this.ActualHeight - this.Margin.Bottom,
- this.ActualWidth - this.Margin.Left - this.Margin.Top,
- this.Margin.Bottom
- );
- drawingContext.DrawRectangle(bottomBrush, null, bottomRect);
- var topLeftRect = new Rect(0, 0, this.Margin.Left, this.Margin.Top);
- drawingContext.DrawRectangle(topLeftBrush, null, topLeftRect);
- var topRightRect = new Rect(this.ActualWidth - this.Margin.Left, 0,
- this.Margin.Right, this.Margin.Top
- );
- drawingContext.DrawRectangle(topRightBrush, null, topRightRect);
- var bottomLeftRect = new Rect(0, this.ActualHeight - this.Margin.Bottom,
- this.Margin.Left, this.Margin.Bottom
- );
- drawingContext.DrawRectangle(bottomLeftBrush, null, bottomLeftRect);
- var bottomRightRect = new Rect(this.ActualWidth - this.Margin.Right,
- this.ActualHeight - this.Margin.Bottom,
- this.Margin.Right, this.Margin.Bottom
- );
- drawingContext.DrawRectangle(bottomRightBrush, null, bottomRightRect);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement