Esempio n. 1
0
        private static void ShowDecoratorProperty_Changed(DependencyObject d, DependencyPropertyChangedEventArgs e)
        {
            GuideLineDecorator decorator = (GuideLineDecorator)d;
            bool showDecorator           = (bool)e.NewValue;

            if (showDecorator)
            {
                decorator.ShowAdorner();
            }
            else
            {
                decorator.HideAdorner();
            }
        }
Esempio n. 2
0
        public GuideLinAdorner(ContentControl designerItem)
            : base(designerItem)
        {
            SnapsToDevicePixels = true;
            GuideLineDecorator item = designerItem as GuideLineDecorator;

            if (item.IsVline == true)
            {
                this.chrome             = new VGuidelineChrome();
                this.chrome.DataContext = designerItem;
                this.visuals            = new VisualCollection(this);
                this.visuals.Add(this.chrome);
            }
            else
            {
                this.chrome             = new HGuidelineChrome();
                this.chrome.DataContext = designerItem;
                this.visuals            = new VisualCollection(this);
                this.visuals.Add(this.chrome);
            }
        }
Esempio n. 3
0
        protected override void OnMouseMove(System.Windows.Input.MouseEventArgs e)
        {
            base.OnMouseMove(e);
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                GuideLineDecorator LineDecorator = this.DataContext as GuideLineDecorator;
                if (LineDecorator == null)
                {
                    return;
                }

                containerCanvas = VisualTreeHelper.GetParent(VisualTreeHelper.GetParent(LineDecorator)) as Canvas;
                Point p = e.GetPosition(containerCanvas);

                if (LineDecorator.IsVline == true)
                {
                    InofLocation = new Thickness(0, p.Y, -60, 0);
                }
                else
                {
                    InofLocation = new Thickness(p.X, 0, 0, -24);
                }
            }
        }