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


C# Visual.PointToScreen方法代码示例

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


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

示例1: CreateCaret

		/// <summary>
		/// Creates an invisible Win32 caret for the specified Visual with the specified size (coordinates local to the owner visual).
		/// </summary>
		public static bool CreateCaret(Visual owner, Size size)
		{
			if (owner == null)
				throw new ArgumentNullException("owner");
			HwndSource source = PresentationSource.FromVisual(owner) as HwndSource;
			if (source != null) {
				Vector r = owner.PointToScreen(new Point(size.Width, size.Height)) - owner.PointToScreen(new Point(0, 0));
				return SafeNativeMethods.CreateCaret(source.Handle, IntPtr.Zero, (int)Math.Ceiling(r.X), (int)Math.Ceiling(r.Y));
			} else {
				return false;
			}
		}
开发者ID:Altaxo,项目名称:Altaxo,代码行数:15,代码来源:Win32.cs

示例2: SetMousePosition

        /// <summary>
        /// This will move the mouse cursor to a new location
        /// </summary>
        public static void SetMousePosition(Visual relativeTo, Point? offset = null)
        {
            Point point = offset ?? new Point(0, 0);

            Point screenPos = relativeTo.PointToScreen(point);

            SetMousePosition(screenPos);
        }
开发者ID:charlierix,项目名称:AsteroidMiner,代码行数:11,代码来源:UtilityWPF.cs

示例3: GetPixelSnappingOffset

 private static Point GetPixelSnappingOffset(Visual visual, Visual rootVisual)
 {
     var point = new Point();
     if (rootVisual != null)
     {
         var transform = visual.TransformToAncestor(rootVisual) as Transform;
         if ((transform != null) && transform.Value.HasInverse)
         {
             point = visual.PointFromScreen(visual.PointToScreen(point));
         }
     }
     
     return point;
 }
开发者ID:sbambach,项目名称:ATF,代码行数:14,代码来源:Icon.cs

示例4: ShowWindowMenu

 public static void ShowWindowMenu(HwndSource source, Visual element, Point elementPoint,
     Size elementSize)
 {
     if (elementPoint.X < 0.0 || elementPoint.X > elementSize.Width ||
         (elementPoint.Y < 0.0 || elementPoint.Y > elementSize.Height))
         return;
     Point screenPoint = element.PointToScreen(elementPoint);
     ShowWindowMenu(source, screenPoint, true);
 }
开发者ID:vebin,项目名称:ModernApplicationFramework,代码行数:9,代码来源:ModernChromeWindow.cs

示例5: ConvertRelativePointToScreenInDefaultDpi

 /// <summary>
 /// Converts point in control to screen point in default DPI.
 /// </summary>
 /// <param name="control">Parent control.</param>
 /// <param name="point">Current mouse position.</param>
 /// <returns>Point in default DPI.</returns>
 public Point ConvertRelativePointToScreenInDefaultDpi(Visual control, Point point)
 {
     Point screenPoint = control.PointToScreen(point);
     return GetScreenPointInDefaultDpi(screenPoint);
 }
开发者ID:erindm,项目名称:route-planner-csharp,代码行数:11,代码来源:DockManager.xaml.cs


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