diff options
Diffstat (limited to 'Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs')
| -rw-r--r-- | Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs | 39 |
1 files changed, 20 insertions, 19 deletions
diff --git a/Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs b/Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs index b77f57679..fefd6a12c 100644 --- a/Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs +++ b/Software/Visual_Studio/TEMP/Tango.Graphics2D/VisualBinders/RectangleBinder.cs @@ -11,32 +11,33 @@ namespace Tango.Graphics2D.VisualBinders { public class RectangleBinder : IVisualBinder { - public VisualBinderResult CreateVisual(FrameworkElement element, Drawing2DHost host) + public void DrawVisual(FrameworkElement element, Drawing2DHost host, DrawingContext context) { Rectangle rectangle = element as Rectangle; - using (Drawing2DContext d2 = new Drawing2DContext()) - { - var x = d2.Context; - - var location = host.GetElementLocation(rectangle); - - Pen pen = null; + var location = host.GetElementLocation(rectangle); + var size = host.GetElementSize(rectangle); - if (rectangle.Stroke != null) - { - pen = new Pen(rectangle.Stroke, rectangle.StrokeThickness); - pen.DashCap = rectangle.StrokeDashCap; - //TODO: add some stroke features... - } + Pen pen = null; - x.DrawRectangle(rectangle.Fill, pen, new Rect(location.X, location.Y, rectangle.Width, rectangle.Height)); + if (rectangle.Stroke != null) + { + pen = new Pen(rectangle.Stroke, rectangle.StrokeThickness); + pen.DashCap = rectangle.StrokeDashCap; + //TODO: add some stroke features... + } - VisualBinderResult result = new VisualBinderResult(d2.Visual); - result.AddBasicContainers(element); + context.DrawRectangle(rectangle.Fill, pen, new Rect(location.X, location.Y, size.Width, size.Height)); + } - return result; - } + public List<DependencyProperty> GetRenderProperties() + { + return new List<DependencyProperty>() + { + Rectangle.OpacityProperty, + Rectangle.VisibilityProperty, + Rectangle.FillProperty, + }; } } } |
