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


C# GeneralTransform.Transform方法代码示例

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


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

示例1: CreateMatrix

 internal static Matrix CreateMatrix(GeneralTransform transform)
 {
     if (transform != null && !IsIdentity(transform))
     {
         Point offset = transform.Transform(new Point(0, 0));
         Point i = transform.Transform(new Point(1, 0)).Minus(offset);
         Point j = transform.Transform(new Point(0, 1)).Minus(offset);
         Matrix matrix = new Matrix(i.X, i.Y, j.X, j.Y, offset.X, offset.Y);
         return matrix;
     }
     else
     {
         return Matrix.Identity;
     }
 }
开发者ID:Motaz-Al-Zoubi,项目名称:xaml-sdk,代码行数:15,代码来源:MathHelper.cs

示例2: TransformRectByMiddlePoint

		static Rect TransformRectByMiddlePoint(GeneralTransform transform, Rect r)
		{
			// we don't want to adjust the size of the control when moving it out of a scaled
			// container, we just want to move it correcly
			Point p = new Point(r.Left + r.Width / 2, r.Top + r.Height / 2);
			Vector movement = transform.Transform(p) - p;
			return new Rect(r.TopLeft + movement, r.Size);
		}
开发者ID:JGroot,项目名称:SharpDevelop,代码行数:8,代码来源:PlacementOperation.cs

示例3: MouseMoved

        /// <summary>
        /// Handles when the mouse moves
        /// </summary>
        /// <param name="mousePos"></param>
        /// <param name="screenToSceneTransform"></param>
        public void MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform)
        {
            if (screenToSceneTransform == null)
                return;
            // Convert the mouse coordinates to scene coordinates
            mousePos = screenToSceneTransform.Transform(mousePos);

            bool newLocked = false;
            Point newPoint = mousePos;

            if (points.Count > 0)
            {
                // Transform the minimum distance ignoring the translation
                Rect minimumBounds = screenToSceneTransform.TransformBounds(minimumDistance);

                double nearestDistanceSquared;
                newPoint = GetEllipseScaledNearestPoint(points, mousePos, (Vector) (minimumBounds.Size),
                                                        out nearestDistanceSquared);
                newLocked = nearestDistanceSquared <= 1;
            }

            bool lockedChanged = newLocked != locked;
            bool pointChanged = newPoint != closestPoint;

            locked = newLocked;
            closestPoint = newPoint;

            if ((pointChanged && locked) || lockedChanged)
            {
                OnClosestPointChanged();
            }
        }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:37,代码来源:ClosestPointPicker.cs

示例4: MouseMoved

 /// <summary>
 /// Handles when the mouse moves
 /// </summary>
 /// <param name="mousePos"></param>
 /// <param name="screenToSceneTransform"></param>
 public Point MouseMoved(Point mousePos, GeneralTransform screenToSceneTransform) {
   if(screenToSceneTransform == null)
     return new Point(0, 0);
   // Convert the mouse coordinates to scene coordinates
   mousePos = screenToSceneTransform.Transform(mousePos);
   // Transform the minimum distance ignoring the translation
   Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
   return MouseMoved(mousePos, minimumBounds);
 }
开发者ID:jrc60752,项目名称:iRacingAdminSync,代码行数:14,代码来源:ClosestPointPicker.cs

示例5: QueueMouseMove

 public void QueueMouseMove(Point mousePos, GeneralTransform screenToSceneTransform) {
   mousePos = screenToSceneTransform.Transform(mousePos);
   Rect minimumBounds = screenToSceneTransform.TransformBounds(_minimumDistance);
   _mousePosQueue.Add(new PointAndBounds(mousePos, minimumBounds));
 }
开发者ID:jrc60752,项目名称:iRacingAdminSync,代码行数:5,代码来源:ClosestPointPicker.cs

示例6: ArrangeTicksAndMarkers

 void ArrangeTicksAndMarkers(IEnumerable<DataAxisTick> ticksOrMarkers, GeneralTransform axisTransform, Size arrangeSize, double tickLength)
 {
     foreach (var tick in ticksOrMarkers)
     {
         Point tickLabelPosition;
         switch (AxisLocation)
         {
             case AxisLocation.Top:
             case AxisLocation.Bottom:
                 tick.Location = axisTransform.Transform(new Point(tick.Value, 0)).X;
                 if (tick.TextBlockBorder != null)
                 {
                     var yPos = tickLength;
                     if (AxisLocation == AxisLocation.Top) yPos += tick.TextBlockBorder.DesiredSize.Height;
                     tickLabelPosition = axisTransform.Transform(new Point(tick.Value, yPos));
                     tickLabelPosition.X -= tick.TextBlockBorder.DesiredSize.Width / 2;
                     tickLabelPosition.X = Math.Min(Math.Max(tickLabelPosition.X, 0), arrangeSize.Width - tick.TextBlockBorder.DesiredSize.Width);
                     tick.TextBlockBorder.Arrange(new Rect(tickLabelPosition, tick.TextBlockBorder.DesiredSize));
                 }
                 break;
             case AxisLocation.Left:
             case AxisLocation.Right:
                 tick.Location = axisTransform.Transform(new Point(tick.Value, 0)).Y;
                 if (tick.TextBlockBorder != null)
                 {
                     tickLabelPosition = axisTransform.Transform(new Point(tick.Value, tickLength + 2));
                     if (AxisLocation == AxisLocation.Left) tickLabelPosition.X -= tick.TextBlockBorder.DesiredSize.Width;
                     tickLabelPosition.Y -= tick.TextBlockBorder.DesiredSize.Height / 2;
                     tickLabelPosition.Y = Math.Min(Math.Max(tickLabelPosition.Y, 0), arrangeSize.Height - tick.TextBlockBorder.DesiredSize.Height);
                     tick.TextBlockBorder.Arrange(new Rect(tickLabelPosition, tick.TextBlockBorder.DesiredSize));
                 }
                 break;
             default:
                 throw new ApplicationException("DataAxis: Unknown AxisLocation value.");
         }
     }
 }
开发者ID:AuditoryBiophysicsLab,项目名称:ESME-Workbench,代码行数:37,代码来源:DataAxis.cs

示例7: SetCoordinatesOnCursor

 /// <summary>
 /// Sets the coordinates on the cursor using the transform passed in
 /// </summary>
 /// <param name="mousePos"></param>
 /// <param name="uiElement"></param>
 /// <param name="transform"></param>
 public void SetCoordinatesOnCursor(Point mousePos, FrameworkElement uiElement, GeneralTransform transform)
 {
     if (transform != null && hasPermissionToRun)
     {
         try
         {
             cursorPosition = mousePos;
             lastCoordinate = transform.Transform(mousePos);
             SetStringFormat(transform);
             SetCoordinatesOnCursor(uiElement);
         }
         catch (Exception)
         {
             hasPermissionToRun = false;
         }
     }
 }
开发者ID:idaohang,项目名称:Helicopter-Autopilot-Simulator,代码行数:23,代码来源:MouseCursorCoordinateDrawer.cs


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