线/线几何的顾问 [英] Adorner for Line/linegeometry

查看:104
本文介绍了线/线几何的顾问的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试创建一个装饰类,将一个装饰类放在LineGeometry上.我只希望单击该行时在行的起点和终点出现两个拇指.有人可以帮我吗?

Hi, I''m trying to create an adorner class that puts an adorner on a LineGeometry. I just want two thumbs to appear at the start and endpoints of the line when it''s clicked on. Can anyone help me with this?

推荐答案

K,所以我有点放弃尝试在行的末端绘制大拇指,而是改用椭圆形(原本不应该做任何事情,只是提供视觉提示)

这是我为任何关心的人想出的代码(装饰一个connectorView,它本质上是一个线几何):

K, so I kind of gave up on trying to draw thumbs on the ends of my line but instead I used ellipses (they weren''t supposed to do anything anyway, just provide visual cues)

Here''s the code I came up with for anyone who cares (adornes a connectorView which is essentially a linegeometry):

public class LineAdorner : Adorner
    {
        public LineAdorner(UIElement adornedElement)
            : base(adornedElement)
        {
        }
        protected override void OnRender(DrawingContext drawingContext)
        {
            if (this.AdornedElement.GetType() == typeof(ConnectorView))
            {
                ConnectorView target = this.AdornedElement as ConnectorView;
                drawingContext.DrawEllipse(Brushes.Black, null, target.StartPoint, 4, 4);
                drawingContext.DrawEllipse(Brushes.Black, null, target.EndPoint, 4, 4);
            }
        }
    }


这篇关于线/线几何的顾问的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆