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


C# UIElement.TranslatePoint方法代码示例

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


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

示例1: GetPosition

		protected Point GetPosition(UIElement relativeTo, FrameworkElement element, bool centered)
		{
			Point point = new Point(Canvas.GetLeft(element), Canvas.GetTop(element));
			if(centered)
				point.Offset(element.Width / 2, element.Height / 2);
			return relativeTo.TranslatePoint(point, window);
		}
开发者ID:zhuangfangwang,项目名称:ise,代码行数:7,代码来源:ContactTestsBase.cs

示例2: 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 && aLayer.GetAdorners(selectedElement) != null)
                {
                    // Remove the adorner from the selected element
                    aLayer.Remove(aLayer.GetAdorners(selectedElement)[0]);
                    selectedElement = null;
                }
            }
            //If adding a new link
            if (e.Source.GetType() == typeof(SystemBasicView))
            {
                if (e.Source.GetType() == typeof(SystemBasicView) && _isAddNewLink)
                {
                    if (!_isLinkStarted)
                    {
                        if (_link == null || _link.EndPoint != _link.StartPoint)
                        {
                            _isLinkStarted = true;
                            _linkedSystem = e.Source as SystemBasicView;
                            SystemViewModel svm = (_linkedSystem.DataContext) as SystemViewModel;
                            _tempLink = new TemporaryConnectorViewModel(svm);
                            _tempLink.StartPostion = _linkedSystem.Position;
                            e.Handled = true;
                        }
                    }
                }
                // If a componentView is selected, add adorner layer to it
                else
                {
                    _isDown = true;
                    _startPoint = e.GetPosition(myCanvas);

                    selectedElement = e.Source as UIElement;
                    _originalPoint = selectedElement.TranslatePoint(new Point(0, 0), myCanvas);

                    aLayer = AdornerLayer.GetAdornerLayer(selectedElement);
                    aLayer.Add(new ResizingAdorner(selectedElement, myCanvas));

                    selected = true;
                    e.Handled = true;
                }
            }
        }
开发者ID:shader,项目名称:QuickArch,代码行数:49,代码来源:SystemDiagramView.xaml.cs

示例3: AddDraggedColumnGhost

    public void AddDraggedColumnGhost( UIElement element )
    {
      if( ( element == null ) || m_elementToDraggedElementAdorner.ContainsKey( element ) )
        return;

      // Get the Rect for the DataGridControl
      DataGridControl dataGridControl = this.DraggedDataGridContext.DataGridControl;

      Rect dataGridControlRect = new Rect( 0, 0, dataGridControl.ActualWidth, dataGridControl.ActualHeight );

      Point elementToDataGridControl = element.TranslatePoint( ColumnReorderingDragSourceManager.EmptyPoint, dataGridControl );

      // Get the Rect for the element that request a ghost
      Rect elementRect = new Rect( elementToDataGridControl, element.RenderSize );

      // This is a special case with the current Element that is always layouted, but can be out of view
      if( !elementRect.IntersectsWith( dataGridControlRect ) )
        return;

      AnimatedDraggedElementAdorner adorner = new AnimatedDraggedElementAdorner( element, this.AdornerLayerInsideDragContainer, true );

      this.ApplyContainerClip( adorner );

      this.AdornerLayerInsideDragContainer.Add( adorner );

      m_elementToDraggedElementAdorner.Add( element, adorner );
    }
开发者ID:austinedeveloper,项目名称:WpfExtendedToolkit,代码行数:27,代码来源:ColumnReorderingDragSourceManager.cs


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