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


C# Window.TranslatePoint方法代码示例

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


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

示例1: Lookup

        public Lookup(TextBox parent, Window owner)
            : this()
        {
            _parent = parent;
            Owner = owner;

            var relative = new Point(0, parent.ActualHeight);
            Point desiredLocation = owner.TranslatePoint(relative, parent);

            Point point = Owner.PointToScreen(desiredLocation);

            Top = point.Y;
            Left = point.X;

            Show();
        }
开发者ID:abombss,项目名称:storyteller,代码行数:16,代码来源:Lookup.xaml.cs

示例2: RefreshScalingLine

        private void RefreshScalingLine(Window wnd, Element element, Canvas canvas)
        {
            Vector offset = new Vector(wnd.Width / 2, 0);//ScalingWindow.Height + 125);
            Point translatedPoint = wnd.TranslatePoint(new Point(0, 0) + offset, canvas);

            canvas.Children.Remove(ScalingLine);

            ScalingLine = new Line();
            ScalingLine.X1 = translatedPoint.X;
            ScalingLine.Y1 = translatedPoint.Y;

            ScalingLine.X2 = element.Position.X + element.Width / 2;
            ScalingLine.Y2 = element.Position.Y + element.Height / 8;
            SolidColorBrush redBrush = new SolidColorBrush();
            redBrush.Color = Colors.DarkGreen;
            ScalingLine.StrokeThickness = 3;
            ScalingLine.Stroke = redBrush;

            //проверка, находится ли это окно в области канваса
            if (new Rect(canvas.RenderSize).Contains(new Point(ScalingLine.X1, ScalingLine.Y1)))
                canvas.Children.Add(ScalingLine);
        }
开发者ID:steamprodz,项目名称:DantistApp,代码行数:22,代码来源:MainWindow.xaml.cs

示例3: DraggedDelta

        private static Vector DraggedDelta(InputDevice inputDevice, Window window, UIElement relativeTo)
        {
            MouseDevice mouse = inputDevice as MouseDevice;
            Contact contact = inputDevice as Contact;

            // get the current position
            Point currentPosition = (mouse == null) ? contact.GetPosition(window) : mouse.GetPosition(window);

            // get the down state
            if (!deviceStateDictionary.ContainsKey(inputDevice))
            {
                return ZeroVector;
            }

            // translate to the relativeTo elementToDrag
            Point downPosition = deviceStateDictionary[inputDevice].Position;

            if (relativeTo != window)
            {
                currentPosition = window.TranslatePoint(currentPosition, relativeTo);
                downPosition = window.TranslatePoint(downPosition, relativeTo);
            }

            return (currentPosition - downPosition);
        }
开发者ID:gburgess,项目名称:sc_demo_app,代码行数:25,代码来源:ContactsHelper.cs


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