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


C# AdornerLayer类代码示例

本文整理汇总了C#中AdornerLayer的典型用法代码示例。如果您正苦于以下问题:C# AdornerLayer类的具体用法?C# AdornerLayer怎么用?C# AdornerLayer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


AdornerLayer类属于命名空间,在下文中一共展示了AdornerLayer类的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: DraggingWidgetHelper

 /// <summary>
 /// Initialize the dragging helper
 /// </summary>
 /// <param name="panel"></param>
 public DraggingWidgetHelper(Canvas panel)
 {
     Panel = panel;
     adornerLayer = AdornerLayer.GetAdornerLayer(panel);
     elements = new Dictionary<FrameworkElement, ResizingAdorner>();
     ElementsRightBottom = new Dictionary<FrameworkElement, Point>();
 }
开发者ID:barbarossia,项目名称:CWF,代码行数:11,代码来源:DraggingWidgetHelper.cs

示例4: drag_Rotate_Started

		private void drag_Rotate_Started(DragListener drag)
		{
			_adornerLayer = this.adornerPanel.TryFindParent<AdornerLayer>();

			var designerItem = this.ExtendedItem.Component as FrameworkElement;
			this.parent = VisualTreeHelper.GetParent(designerItem) as UIElement;
			this.centerPoint = designerItem.TranslatePoint(
				new Point(designerItem.ActualWidth*designerItem.RenderTransformOrigin.X,
				          designerItem.ActualHeight*designerItem.RenderTransformOrigin.Y),
				this.parent);

			Point startPoint = Mouse.GetPosition(this.parent);
			this.startVector = Point.Subtract(startPoint, this.centerPoint);

			if (this.rotateTransform == null)
			{
				this.initialAngle = 0;
			}
			else
			{
				this.initialAngle = this.rotateTransform.Angle;
			}

			rtTransform = this.ExtendedItem.Properties[FrameworkElement.RenderTransformProperty].Value;

			operation = PlacementOperation.Start(extendedItemArray, PlacementType.Resize);
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:27,代码来源:RotateThumbExtension.cs

示例5: DragAdorner

 // Methods
 public DragAdorner(UIElement adornedElement)
     : base(adornedElement)
 {
     this.adornerLayer = AdornerLayer.GetAdornerLayer(adornedElement);
       this.InitializeAdornment();
       DependencyPropertyDescriptor.FromProperty(DragDropState.MousePositionPropertyKey.DependencyProperty, base.AdornedElement.GetType()).AddValueChanged(base.AdornedElement, new EventHandler(this.MousePositionChanged));
 }
开发者ID:sunoru,项目名称:PBO,代码行数:8,代码来源:DragAdorner.cs

示例6: 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

示例7: AdornerDecorator

 public AdornerDecorator()
 {
     AdornerLayer = new AdornerLayer();
     ((ISetLogicalParent)AdornerLayer).SetParent(this);
     AdornerLayer.ZIndex = int.MaxValue;
     VisualChildren.Add(AdornerLayer);
 }
开发者ID:Arlorean,项目名称:Perspex,代码行数:7,代码来源:AdornerDecorator.cs

示例8: 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

示例9: OnLoaded

 private void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
 {
     canvas = this.GetVisualChild<Canvas>();
     adornerlayer = AdornerLayer.GetAdornerLayer(this);
     var designableDragAndResizeChrome = new DesignableResizeChrome(selection);
     selectionAdorner = new DesignableResizeAdorner(canvas, selection, designableDragAndResizeChrome);
 }
开发者ID:modulexcite,项目名称:Glass-Legacy,代码行数:7,代码来源:Designer.cs

示例10: ClearAdorner

 private static void ClearAdorner(AdornerLayer layer, LightBoxAdorner adorner)
 {
     // null条件演算子でいいかも。
     if (layer != null && adorner != null)
     {
         layer.Remove(adorner);
     }
 }
开发者ID:sourcechord,项目名称:WPFSamples,代码行数:8,代码来源:LightBox.cs

示例11: ColumnReorderingDragSourceManager

 public ColumnReorderingDragSourceManager( UIElement draggedElement,
                                                   AdornerLayer adornerLayerInsideDragContainer,
                                                   UIElement dragContainer,
                                                   bool enableAutoScroll,
                                                   bool showDraggedElementGhost )
   : base( draggedElement, adornerLayerInsideDragContainer, dragContainer, enableAutoScroll, showDraggedElementGhost )
 {
 }
开发者ID:Torion,项目名称:WpfExToolkit,代码行数:8,代码来源:ColumnReorderingDragSourceManager.cs

示例12: DraggedAdorner

 public DraggedAdorner(AdornerLayer adornerLayer, UIElement uiElement, DataTemplate dragDropTemplate)
     : base(uiElement)
 {
     this.contentPresenter = new ContentPresenter();
     this.contentPresenter.ContentTemplate = dragDropTemplate;
     this.adornerLayer = adornerLayer;
     this.adornerLayer.Add(this);
 }
开发者ID:ichengzi,项目名称:atnets,代码行数:8,代码来源:DraggedAdorner.cs

示例13: 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

示例14: DropPreviewAdorner

		public DropPreviewAdorner(object feedbackUI, UIElement adornedElt, AdornerLayer layer)
			: base(adornedElt)
        {
			Layer = layer;

			presenter = new ContentPresenter();
			presenter.Content = feedbackUI;
			presenter.IsHitTestVisible = false;
        }
开发者ID:ssickles,项目名称:archive,代码行数:9,代码来源:DropPreviewAdorner.cs

示例15: 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


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