示例#1
0
        public void ChangeCursorPosition(object sender, CursorEventArgs e)
        {
            if (Image == null)
            {
                return;
            }

            System.Windows.Controls.Image imageControl = _adornedElement as System.Windows.Controls.Image;
            _selectPosition.X += e.Position.X * imageControl.ActualWidth / Image.PixelWidth;
            _selectPosition.Y += e.Position.Y * imageControl.ActualHeight / Image.PixelHeight;
            _cursorband.Data   = CreateCursorData(_selectPosition);
            AdornerLayer layer = AdornerLayer.GetAdornerLayer(_adornedElement);

            layer.InvalidateArrange();
            OnCursorChanged(_selectPosition);
        }
示例#2
0
        public void ChangeFrame(object sender, CursorEventArgs e)
        {
            CursorAdorner cusorAdoner = sender as CursorAdorner;
            BitmapSource  img         = cusorAdoner.Image;

            double R = img.DpiX * 0.4;

            Int32Rect rect = new Int32Rect();

            rect.X      = (int)(e.Position.X - R);
            rect.Y      = (int)(e.Position.Y - R);
            rect.Width  = (int)(2 * R);
            rect.Height = (int)(2 * R);
            if (rect.X + rect.Width >= img.PixelWidth)
            {
                rect.X -= (int)(rect.X + rect.Width - img.PixelWidth + 1);
            }
            if (rect.Y + rect.Height >= img.PixelHeight)
            {
                rect.Y -= (int)(rect.Y + rect.Height - img.PixelHeight + 1);
            }
            if (rect.X < 0)
            {
                rect.Width += rect.X;
                if (rect.Width < 1)
                {
                    rect.Width = 1;
                }
                rect.X = 0;
            }
            if (rect.Y < 0)
            {
                rect.Height += rect.Y;
                if (rect.Height < 1)
                {
                    rect.Height = 1;
                }
                rect.Y = 0;
            }

            System.Windows.Controls.Image imageControl = _adornedElement as System.Windows.Controls.Image;
            imageControl.Source = new CroppedBitmap(img, rect);
            //if (_cursorband.Data == null)
            updateCursor();
        }
示例#3
0
        public void ChangeCursorPosition(object sender, CursorEventArgs e)
        {
            BeamParams bp = (BeamParams)beamItemsView.View.CurrentItem;

            bp.O = new Point(e.Position.X, e.Position.Y);
        }