当前位置: 首页>>代码示例>>C#>>正文


C# AdornerLayer.Add方法代码示例

本文整理汇总了C#中AdornerLayer.Add方法的典型用法代码示例。如果您正苦于以下问题:C# AdornerLayer.Add方法的具体用法?C# AdornerLayer.Add怎么用?C# AdornerLayer.Add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AdornerLayer的用法示例。


在下文中一共展示了AdornerLayer.Add方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: AddAdorner

        internal void AddAdorner(
            AdornerLayer treeViewAdornerLayer, FrameworkElement adornedElement, ExplorerEFElement explorerElement,
            ExplorerFrame explorerFrame)
        {
            var adornerY = GetAdornerY(adornedElement, explorerElement, explorerFrame);

            if (adornerY >= 0)
            {
                SearchTickAdorner adorner;
                if (!_adorners.TryGetValue(adornerY, out adorner))
                {
                    adorner = new SearchTickAdorner(adornerY, adornedElement);
                    _adorners[adornerY] = adorner;
                    treeViewAdornerLayer.Add(adorner);

                    // adding adorners in batches of 100 - see bug: Windows OS Bugs 1750717 
                    if ((_adorners.Count % 100) == 0)
                    {
                        treeViewAdornerLayer.UpdateLayout();
                    }
                }

                adorner.AddExplorerElement(explorerElement);
            }
        }
开发者ID:Cireson,项目名称:EntityFramework6,代码行数:25,代码来源:SearchAdornerDecorator.cs

示例2: Plugitem_PreviewMouseMove

        /// <summary>
        /// 拖拽工具插头
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Plugitem_PreviewMouseMove(object sender,MouseEventArgs e) {
            if(e.LeftButton == MouseButtonState.Pressed) {
                try {
                    AbstractCableKit drogKit = Kits_ListBox.SelectedItem as AbstractCableKit;
                    AbstractCableKit kit = (AbstractCableKit)drogKit.Clone();
                    Grid grid = sender as Grid;
                    var dragData = new DataObject(typeof(AbstractCableKit), kit);

                    Point pos = e.GetPosition(Kits_ListBox);
                    HitTestResult result = VisualTreeHelper.HitTest(Kits_ListBox, pos);
                    if (result == null)
                        return;
                    ListBoxItem listBoxItem = EquipmentUtils.FindVisualParent<ListBoxItem>(result.VisualHit); // Find your actual visual you want to drag
                    DragDropAdorner adorner = new DragDropAdorner(listBoxItem);
                    adornerLayer = AdornerLayer.GetAdornerLayer(this);
                    adornerLayer.Add(adorner);

                    DragDrop.DoDragDrop(grid, dragData, DragDropEffects.Copy);
                    adornerLayer.Remove(adorner);
                    adornerLayer = null;
                }
                catch
                {

                }
            }
        }
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:32,代码来源:CableKitsFactory.xaml.cs

示例3: WindowLoaded

        private void WindowLoaded(object sender, RoutedEventArgs e)
        {
            adornerLayer = AdornerLayer.GetAdornerLayer(elementsGrid);

            foreach (Panel toAdorn in elementsGrid.Children)
                adornerLayer.Add(new ResizingAdorner(toAdorn.Children[0]));
        }
开发者ID:samgonzalezr,项目名称:WPFSamples,代码行数:7,代码来源:MainWindow.xaml.cs

示例4: myCanvas_PreviewMouseLeftButtonDown

        // Handler for element selection on the canvas providing resizing adorner
        void myCanvas_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {
            // Remove selection on clicking anywhere the window
            if (selected)
            {
                selected = false;
                if (selectedElement != null)
                {
                    // Remove the adorner from the selected element
                    aLayer.Remove(aLayer.GetAdorners(selectedElement)[0]);
                    selectedElement = null;
                }
            }

            // If any element except canvas is clicked,
            // assign the selected element and add the adorner
            if (e.Source != myCanvas)
            {
                _isDown = true;
                _startPoint = e.GetPosition(myCanvas);

                selectedElement = e.Source as UIElement;

                _originalLeft = Canvas.GetLeft(selectedElement);
                _originalTop = Canvas.GetTop(selectedElement);

                aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                aLayer.Add(new ResizingAdorner(selectedElement));
                selected = true;
                e.Handled = true;
            }
        }
开发者ID:sagamors,项目名称:AnyWallpapers,代码行数:33,代码来源:Window1.xaml.cs

示例5: DragAdorner

        public DragAdorner(object data, DataTemplate dataTemplate, UIElement adornedElement, AdornerLayer adornerLayer)
            : base(adornedElement)
        {
            _adornerLayer = adornerLayer;
            _contentPresenter = new ContentPresenter() { Content = data, ContentTemplate = dataTemplate, Opacity = 0.75 };

            _adornerLayer.Add(this);
        }
开发者ID:modulexcite,项目名称:Glass-Legacy,代码行数:8,代码来源:DragAdorner.cs

示例6: Window_Loaded_1

        private void Window_Loaded_1(object sender, RoutedEventArgs e)
        {
            myAdornerLayer = AdornerLayer.GetAdornerLayer(win);
            myAdornerLayer.Add(new SimpleCircleAdorner(win));

            //myAdornerLayer = AdornerLayer.GetAdornerLayer(pnl);
            //foreach (UIElement toAdorn in pnl.Children)
            //    myAdornerLayer.Add(new SimpleCircleAdorner(toAdorn));
        }
开发者ID:pmontu,项目名称:Experiments,代码行数:9,代码来源:Window1.xaml.cs

示例7: PostionAdorner

        public PostionAdorner(UIElement adornedElement, AdornerLayer adornerLayer, DataTemplate dataTemplate)
            : base(adornedElement)
        {
            _adornerLayer = adornerLayer;
            _contentPresenter = new ContentPresenter();
            _contentPresenter.ContentTemplate = dataTemplate;

            //加入层中
            _adornerLayer.Add(this);
        }
开发者ID:Mrding,项目名称:Ribbon,代码行数:10,代码来源:PostionAdorner.cs

示例8: HighLight_Adorner

 public HighLight_Adorner(UIElement adornedElement,
     Point startPosition, Size size,double opacity,
     AdornerLayer adornerLayer)
     : base(adornedElement)
 {
     this.opacity = opacity;
     this.size = size;
     this.adornerLayer = adornerLayer;
     adornerLayer.Add(this);
     this.position = startPosition;
 }
开发者ID:PSE-2012,项目名称:MMWTV,代码行数:11,代码来源:HighLight_Adorner.cs

示例9: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e) {
            aLayer = AdornerLayer.GetAdornerLayer(textBox1);
            aLayer.Add(new ScaleAdorner(textBox1));
            //this.MouseLeftButtonDown += new MouseButtonEventHandler(Window1_MouseLeftButtonDown);
            //this.MouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler);
            //this.MouseMove += new MouseEventHandler(Window1_MouseMove);
            //this.MouseLeave += new MouseEventHandler(Window1_MouseLeave);

            //myCanvas.PreviewMouseLeftButtonDown += new MouseButtonEventHandler(myCanvas_PreviewMouseLeftButtonDown);
            //myCanvas.PreviewMouseLeftButtonUp += new MouseButtonEventHandler(DragFinishedMouseHandler);
        }
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:11,代码来源:TestWindow.xaml.cs

示例10: DragAdorner

        /// <summary>
        /// Initializes a new instance of the <see cref="DragAdorner"/> class.
        /// </summary>
        /// <param name="data">The data that's being dragged.</param>
        /// <param name="dataTemplate">The data template to show while dragging.</param>
        /// <param name="adornedElement">The adorned element.</param>
        /// <param name="adornerLayer">The adorner layer.</param>
        public DragAdorner(object data, DataTemplate dataTemplate, UIElement adornedElement, AdornerLayer adornerLayer)
            : base(adornedElement)
        {
            Argument.IsNotNull("data", data);
            Argument.IsNotNull("adornerLayer", adornerLayer);

            _myAdornerLayer = adornerLayer;
            _myContentPresenter = new ContentPresenter { Content = data, ContentTemplate = dataTemplate, Opacity = 0.75 };

            _myAdornerLayer.Add(this);
        }
开发者ID:justdude,项目名称:DbExport,代码行数:18,代码来源:DragAdorner.cs

示例11: AddImageResizers

 public void AddImageResizers(RichTextBox editor)
 {
     var images = GetVisuals(editor).OfType<Image>();
     al = AdornerLayer.GetAdornerLayer(editor);
     foreach (var image in images)
     {
         current = new ResizingAdorner(new ResizingAdorner(image));
         //ResizingAdorner ral = new ResizingAdorner(image);
         al.Add(current);
         al.Update();
         //LIBTODO:
     }
 }
开发者ID:alexiej,项目名称:YATE,代码行数:13,代码来源:ImageHelper.cs

示例12: SimDoubleClick

        private void SimDoubleClick(object sender, MouseButtonEventArgs e) {
            bool canDrawOutPlug = BackPanelUtil.SimDoubleClick(sender, e);
            if (canDrawOutPlug) {
                SocketAttatch.SetPlugOut(this, 1);
            } else {
                PlugInfoAdorner adorner = new PlugInfoAdorner(this);
                mAdornerLayer = AdornerLayer.GetAdornerLayer(this);
                mAdornerLayer.Add(adorner);

               // mAdornerLayer.Remove(adorner);
               // mAdornerLayer = null;
            }
        }
开发者ID:ychost,项目名称:PowerControlSimulation,代码行数:13,代码来源:EtherNetSocket.xaml.cs

示例13: Update

        public void Update(DropType dropType)
        {
            if (_layer == null)
            {
                _layer = AdornerLayer.GetAdornerLayer(AdornedElement);
                _layer.Add(this);
            }

            _parentAdorner?.Remove();
            _dropType = dropType;
            _layer.Update(AdornedElement);
            Visibility = Visibility.Visible;
        }
开发者ID:thiagoromam,项目名称:WpfExperiments,代码行数:13,代码来源:TreeViewItemAdorner.cs

示例14: DraggedAdorner

 public DraggedAdorner(object dragDropData, DataTemplate dragDropTemplate, UIElement adornedElement,
                       AdornerLayer adornerLayer)
     : base(adornedElement)
 {
     _adornerLayer = adornerLayer;
     _contentPresenter = new ContentPresenter
         {
             Content = dragDropData,
             ContentTemplate = dragDropTemplate,
             Opacity = AdornerOpacity
         };
     _adornerLayer.Add(this);
 }
开发者ID:Orange637,项目名称:WpfStudy,代码行数:13,代码来源:DraggedAdorner.cs

示例15: dc_PropertyChanged

 void dc_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e)
 {
     if (e.PropertyName == "LeftPictureLocation")
     {
         var doesThisWork = VisualTreeHelper.GetChild(leftItemsControl, 0);
         var doesThisWorkt = VisualTreeHelper.GetChild(doesThisWork, 0);
         var doesThisWorktt = VisualTreeHelper.GetChild(doesThisWorkt, 0);
         canvasToTouch = (Canvas)doesThisWorktt;
         myAdornerLayer = AdornerLayer.GetAdornerLayer((Visual)doesThisWorktt);
         ad = new SimpleCircleAdorner((UIElement)doesThisWorktt);
         myAdornerLayer.Add(ad);
         myAdornerLayer.IsHitTestVisible = false;
     }
 }
开发者ID:millertrevor,项目名称:visionexperiments,代码行数:14,代码来源:MainWindow.xaml.cs


注:本文中的AdornerLayer.Add方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。