Пример #1
0
        void AssociatedObject_MouseMove(object sender, System.Windows.Input.MouseEventArgs e)
        {
            var pos = e.GetPosition(sender as IInputElement);

            X = CentimeterToPixelConverter.ConvertToCmX(pos.X);
            Y = CentimeterToPixelConverter.ConvertToCmY(pos.Y);
            //Debug.WriteLine("{0:N2}:{1:N2}", CentimeterToPixelConverter.ConvertToCmX(pos.X), CentimeterToPixelConverter.ConvertToCmY(pos.Y));
        }
Пример #2
0
        private void Rectangle_MouseMove(object sender, MouseEventArgs e)
        {
            var rec = sender as Rectangle;

            if (rec.IsMouseCaptureWithin)
            {
                Vector diff = e.GetPosition(rec) - mouseStartPosition;
                Item.Y = Math.Max(0, Item.Y + CentimeterToPixelConverter.ConvertToCmY(diff.Y));
                Item.X = Math.Max(0, Item.X + CentimeterToPixelConverter.ConvertToCmX(diff.X));
            }
        }
Пример #3
0
        private void letfBottom_MouseMove(object sender, MouseEventArgs e)
        {
            var rec = sender as Rectangle;

            if (rec.IsMouseCaptureWithin)
            {
                Vector diff = e.GetPosition(rec) - mouseStartPosition;
                Item.Height = Math.Max(0, Item.Height + CentimeterToPixelConverter.ConvertToCmY(diff.Y));
                Item.Width  = Math.Max(0, Item.Width - CentimeterToPixelConverter.ConvertToCmX(diff.X));
                if (Item.Width > 0)
                {
                    Item.X = Math.Max(0, Item.X + CentimeterToPixelConverter.ConvertToCmX(diff.X));
                }
            }
        }
Пример #4
0
        private void Canvas_MouseMove(object sender, MouseEventArgs e)
        {
            var canvas = sender as Canvas;
            var pos    = e.GetPosition(canvas);

            Debug.WriteLine("{0:N2}:{1:N2}", CentimeterToPixelConverter.ConvertToCmX(pos.X), CentimeterToPixelConverter.ConvertToCmY(pos.Y));
        }