You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
1.1 KiB
38 lines
1.1 KiB
using System.Windows;
|
|
using System.Windows.Documents;
|
|
using System.Windows.Media;
|
|
|
|
namespace HMIControl
|
|
{
|
|
public class FrameAdorner : Adorner
|
|
{
|
|
public static DependencyProperty BorderBrushProperty =
|
|
DependencyProperty.Register("BorderBrush", typeof(SolidColorBrush), typeof(TextAdorner),
|
|
new FrameworkPropertyMetadata(Brushes.Red, FrameworkPropertyMetadataOptions.AffectsRender));
|
|
|
|
public SolidColorBrush BorderBrush
|
|
{
|
|
get
|
|
{
|
|
return (SolidColorBrush)base.GetValue(BorderBrushProperty);
|
|
}
|
|
set
|
|
{
|
|
base.SetValue(BorderBrushProperty, value);
|
|
}
|
|
}
|
|
|
|
public FrameAdorner(UIElement adornedElement)
|
|
: base(adornedElement)
|
|
{
|
|
|
|
}
|
|
|
|
protected override void OnRender(DrawingContext drawingContext)
|
|
{
|
|
Rect rect = new Rect(this.AdornedElement.RenderSize);
|
|
//rect.Inflate(5, 5);
|
|
drawingContext.DrawRoundedRectangle(null, new Pen(BorderBrush, 1.0f), rect, 1, 1);
|
|
}
|
|
}
|
|
}
|
|
|