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


C# AdornerLayer.Remove方法代码示例

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


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

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

示例2: ClearAdorner

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

示例3: LoadCompleted

		void LoadCompleted(HierarchyList<CallTreeNodeViewModel> list, AdornerLayer layer, OverlayAdorner ad)
		{
			layer.Remove(ad);
			treeView.ItemsSource = this.list = list;
			if (list != null && list.Count > 0) {
				ringDiagram.SelectedRoot = this.list[0];
				
				foreach (var item in list) {
					var currentItem = item;
					currentItem.RequestBringIntoView += (sender, e) => treeView.ScrollIntoView(e.Node);
				}
			}
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:13,代码来源:QueryView.xaml.cs

示例4: SearchCompleted

		void SearchCompleted(SearchInfo? result, AdornerLayer layer, OverlayAdorner ad)
		{
			if (!result.HasValue)
				return;
			
			CallTreeNodeViewModel item = GetViewModelFromPath(result.Value.Result.GetPathRelativeTo(result.Value.ResultRoot), result.Value);
			if (item != null) {
				item.IsSelected = true;
				if (oldSearchResult != null)
					oldSearchResult.IsSelected = false;
				oldSearchResult = item;
			}
			layer.Remove(ad);
		}
开发者ID:hefnerliu,项目名称:SharpDevelop,代码行数:14,代码来源:QueryView.xaml.cs

示例5: RemoveAdorner

 private static void RemoveAdorner(UIElement rec)
 {
     adornerLayer = AdornerLayer.GetAdornerLayer(rec);
     System.Diagnostics.Debug.Assert(adornerLayer != null, "Oops, you have not defined an AdornerDecorator in the template, check the generic.xaml file.");
     if (adornerLayer!=null && adornerLayer.GetAdorners(rec) != null)
         adornerLayer.Remove(adornerLayer.GetAdorners(rec)[0]);
 }
开发者ID:ChrisMoreton,项目名称:Test3,代码行数:7,代码来源:SelectionManager.cs

示例6: uiAudioList_MouseMove

        private void uiAudioList_MouseMove(object sender, MouseEventArgs e)
        {
            if (ShouldStartDrag(e))
            {
                this.isDragging = true;

                var item = this.draggedItem.DataContext as IAudioListItemViewModel;
                Debug.Assert(item != null);
                if (item.ShowLyrics)
                {
                    item.SwitchLyricsStateCommand.Execute(null);
                }
                var capturePoint = e.GetPosition(this.draggedItem);
                this.draggedItemAdorner = new DragAdorner(this.dragScope, this.draggedItem, true, capturePoint, 0.7);

                layer = AdornerLayer.GetAdornerLayer(this.dragScope);
                layer.Add(this.draggedItemAdorner);
                this.draggedItem.Visibility = System.Windows.Visibility.Collapsed;

                DragDrop.AddPreviewDragOverHandler(this.dragScope, DragScopeDragOver);
                DragDrop.AddGiveFeedbackHandler(this.dragScope, DragScopeGiveFeedback);
                try
                {
                    DragDrop.DoDragDrop(this.draggedItem, item, DragDropEffects.Move);
                    this.draggedItem.CaptureMouse();
                }
                finally
                {
                    DragDrop.RemovePreviewDragOverHandler(this.dragScope, DragScopeDragOver);
                    DragDrop.RemoveGiveFeedbackHandler(this.dragScope, DragScopeGiveFeedback);
                    this.draggedItem.Visibility = System.Windows.Visibility.Visible;

                    if (layer != null && this.draggedItemAdorner != null) layer.Remove(this.draggedItemAdorner);
                    this.draggedItemAdorner = null;
                    this.draggedItem = null;

                    this.isDragging = false;
                }
            }
        }
开发者ID:punker76,项目名称:VCA-player,代码行数:40,代码来源:AudioListView.xaml.cs

示例7: PreviewClickControl

        public void PreviewClickControl(string controlType, string controlName)
        {
            string childString;
            string temp2 = "test";
            foreach (UIElementInfo temp in ucaVM.UI_Element_List)
            {
                if (temp.UIELEMENT_ID.Equals(controlName))
                {
                    if (controlName == "MyCanvas")
                    {
                        temp2 = "MyCanvas";
                    }
                    if (temp2.Equals(controlName))
                    {
                        temp3 = MyCanvas;
                    }
                    else
                    {
                        foreach (UIElement child in MyCanvas.Children)
                        {
                            childString = child.ToString();
                            if (childString.Contains("RadioButton"))
                            {
                                temp2 = (child as RadioButton).Name;
                            }
                            else if (childString.Contains("TextBox"))
                            {
                                temp2 = (child as TextBox).Name;
                            }
                            else if (childString.Contains("PasswordBox"))
                            {
                                temp2 = (child as PasswordBox).Name;
                            }
                            else if (childString.Contains("ListBox"))
                            {
                                temp2 = (child as ListBox).Name;
                            }
                            else if (childString.Contains("ComboBox"))
                            {
                                temp2 = (child as ComboBox).Name;
                            }
                            else if (childString.Contains("Menu"))
                            {
                                temp2 = (child as Menu).Name;
                            }
                            else if (childString.Contains("Button"))
                            {
                                temp2 = (child as Button).Name;
                            }
                            else if (childString.Contains("Slider"))
                            {
                                temp2 = (child as Slider).Name;
                            }
                            if (temp2.Equals(controlName))
                            {
                                temp3 = child;
                            }

                        }
                    }
                }
            }


            if (selectedElement != null)
            {
                aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                aLayer.Remove(preResizeAorner);
                bLayer.Remove(_rotateAdorner);
            }

            selectedElement = temp3;
            aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
            preResizeAorner = new ResizingAdorner(selectedElement, this);
            aLayer.Add(preResizeAorner);

            bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
            _rotateAdorner = new RotateAdorner(selectedElement, this);
            bLayer.Add(_rotateAdorner);

            string tempString = temp3.ToString();
            ctrVM.LeftButtonMakeTempListItem(temp3, tempString);
        }
开发者ID:KimDongWan,项目名称:Miseng,代码行数:84,代码来源:UICanvasView.xaml.cs

示例8: _PreviewMouseLeftButtonDown

        public void _PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
        {

            string _typeName = null;
            if (agoSelectedElement != null)
            {
                _draggedElementToString = agoSelectedElement.ToString();
                _typeName = ctrVM.UIelementCheckTypeName(agoSelectedElement, _draggedElementToString);
                string xmlTag = ctrVM.fileTabV.scriptV.getBlocks();
                ctrVM.hiddenfileSave(_typeName, xmlTag);
                string jsCode = ctrVM.fileTabV.scriptV.getJSCode();
                ctrVM.JSFileSave(jsCode);
                ctrVM._ucaVM.DomtreeVM.importScriptSrc_To_HTMLDocument(ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js");
            }
            _draggedElementToString = (e.Source as UIElement).ToString();
            _tabControls.TabContols.SelectedIndex = 0;
            if (e.Source == MyCanvas || _draggedElementToString == "System.Windows.Controls.Grid")
            {
                if (selectedElement != null)
                {
                    aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                    bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                    if (aLayer != null && bLayer != null)
                    {
                        aLayer.Remove(preResizeAorner);
                        bLayer.Remove(_rotateAdorner);
                    }
                }
                _draggedElementToString = MyCanvas.ToString();
                selectedElement = MyCanvas;
                object canvasObject = MyCanvas;
                aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                preResizeAorner = new ResizingAdorner(selectedElement, this);
                aLayer.Add(preResizeAorner);

                bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                _rotateAdorner = new RotateAdorner(selectedElement, this);
                bLayer.Add(_rotateAdorner);
                //여기오류
                ctrVM._ucaVM.currentUIInfo = ctrVM._ucaVM.UI_Element_List[0];
                ctrVM._ucaVM.preview.clickedControl("MyCanvas");
                ctrVM.LeftButtonMakeTempListItem(canvasObject, _draggedElementToString);
                string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js";
                ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS);
                ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js";

            }
            else
            {
                _isPreMouseDown = true;
                _dragStartPoint = e.GetPosition(MyCanvas);
                _draggedElement = e.Source as UIElement;
                MyCanvas.CaptureMouse();
                e.Handled = true;

                if (selectedElement != null)
                {
                    aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                    bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                    aLayer.Remove(preResizeAorner);
                    bLayer.Remove(_rotateAdorner);
                }
                ctrVM._ucaVM.currentUIInfo = search_UIinfo(e.Source.ToString().Split(new char[] { ':', ' ' }).Last());
                selectedElement = e.Source as UIElement;
                aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                preResizeAorner = new ResizingAdorner(selectedElement, this);
                aLayer.Add(preResizeAorner);

                bLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                _rotateAdorner = new RotateAdorner(selectedElement, this);
                bLayer.Add(_rotateAdorner);
                //ctrVM._ucaVM.preview 자꾸 널.. 버튼 눌렀다가 캔버스 눌렀다가 버튼누르면 널 .. 널죽이겠다..                

                ctrVM._ucaVM.preview.clickedControl(e.Source);
                ctrVM.LeftButtonMakeTempListItem(e.Source, _draggedElementToString);
                string pathJS = Environment.GetEnvironmentVariable("USERPROFILE") + "\\MisengWorkSpace\\" + ctrVM.current_projectName + "\\Tizen\\" + ctrVM.current_projectName + "\\js\\" + ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js";
                ctrVM.SrcCodeVM.GetSrcOfPathJS(pathJS);
                ctrVM.CURRENT_JS = ctrVM.current_Scene + "_" + ctrVM.current_typeName + ".js";

            }
            agoSelectedElement = selectedElement;

        }
开发者ID:KimDongWan,项目名称:Miseng,代码行数:83,代码来源:UICanvasView.xaml.cs

示例9: ReloadingFrame

        private void ReloadingFrame()
        {
            var model = this.DataContext as ShellViewModel;
            canvas.Children.Clear();

            if (model.CurrentPage != null)
            {
                foreach (var frame in model.CurrentPage.Frames)
                {
                    label =
                        InitLabel(
                            Math.Abs(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X -
                                     ToOriginal(frame.Coordinates.TopRight, model.CurrentPage.Zoom).X),
                            Math.Abs(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y -
                                     ToOriginal(frame.Coordinates.BottomLeft, model.CurrentPage.Zoom).Y), frame.Id);

                    Canvas.SetLeft(label, ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X);
                    Canvas.SetTop(label, ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y);
                    Console.WriteLine(ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).X + ";" + ToOriginal(frame.Coordinates.TopLeft, model.CurrentPage.Zoom).Y + ";" + frame.Angle);
                    label.RenderTransform = new RotateTransform(frame.Angle);
                    canvas.Children.Add(label);
                    label.Content = canvas.Children.Count;
                    aLayer = AdornerLayer.GetAdornerLayer(label);
                    aLayer.Add(new HelperAdorner(label));
                    aLayer.Remove(aLayer.GetAdorners(label).First());
                }
            }

           model.NotifyZoom();
        }
开发者ID:leminhtu1204,项目名称:Editor,代码行数:30,代码来源:ShellView.xaml.cs

示例10: RemoveScaleAdorner

        public static void RemoveScaleAdorner(ref AdornerLayer aLayer,ref Viewbox vb) {
            aLayer = AdornerLayer.GetAdornerLayer(vb);
            aLayer.Remove(new ScaleAdorner(vb));

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


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