Beispiel #1
0
        /// <summary>
        /// 表示位置の設定
        /// </summary>
        /// <param name="screenPosition"></param>
        public void SetScreenPosition(Point screenPosition)
        {
            var pos = AdornedElement.PointFromScreen(screenPosition);

            Translate.X = pos.X - Offset.X;
            Translate.Y = pos.Y - Offset.Y;
            AdornerLayer.Update();
        }
Beispiel #2
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            var visualBrush = new VisualBrush(_overlay);

            var point = AdornedElement.PointFromScreen(DragDropManager.GetMousePosition());

            drawingContext.DrawRectangle(visualBrush, null, new Rect(point, _overlay.RenderSize));
            base.OnRender(drawingContext);
        }
Beispiel #3
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (AdornedElement != null)
            {
                var screenPos = new Win32.POINT();
                if (Win32.GetCursorPos(ref screenPos))
                {
                    var pos  = AdornedElement.PointFromScreen(new Point(screenPos.X, screenPos.Y));
                    var rect = new Rect(new Point(pos.X - _posRelative.X, pos.Y - _posRelative.Y), _adornerElementSize);

                    //System.Diagnostics.Trace.TraceInformation("Adorner Pos = {0},{1},{2},{3}", rect.X, rect.Y, rect.Width, rect.Height);

                    drawingContext.DrawRectangle(_imageBrush, null, rect);
                }
            }
        }
Beispiel #4
0
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (AdornedElement != null)
            {
                var screenPos = new Win32.POINT();
                if (Win32.GetCursorPos(ref screenPos))
                {
                    var pos = AdornedElement.PointFromScreen(new Point(screenPos.X + 10, screenPos.Y + 10));

                    var ft   = DrawUtil.DrawText(_tip, _fgBrush);
                    var rect = new Rect(pos.X, pos.Y, ft.Width + 10, ft.Height + 6);

                    drawingContext.DrawRectangle(_bgBrush, null, rect);
                    drawingContext.DrawText(ft, new Point(pos.X + 5, pos.Y + 3));
                }
            }
        }
        protected override void OnRender(DrawingContext drawingContext)
        {
            base.OnRender(drawingContext);

            if (AdornedElement == null || _pen == null || DoubleUtil.IsZero(_length))
            {
                return;
            }

            var screenPos = new Utils.Win32.POINT();

            if (Utils.Win32.GetCursorPos(ref screenPos))
            {
                var pos = AdornedElement.PointFromScreen(new Point(screenPos.X, screenPos.Y));

                drawingContext.DrawLine(_pen, new Point(pos.X, 0), new Point(pos.X, _length));
                drawingContext.DrawLine(_pen, new Point(0, pos.Y), new Point(_length, pos.Y));
            }
        }