當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。