Пример #1
0
 private void OutCanvas_OnMouseMove(object sender, MouseEventArgs e)
 {
     if (IsMove && IsMouseButtonDown(e))
     {
         Point  position = e.GetPosition((IInputElement)sender);
         Vector vector   = position - _buffPosition;
         (double x, double y) = InCanvas.GetXY();
         InCanvas.SetXY(vector.X + x, vector.Y + y);
         _buffPosition = position;
     }
 }
Пример #2
0
        private void 获取InCanvas相对于OutCanvas的位置Button_OnClick(object sender,
                                                             RoutedEventArgs e)
        {
            double x = InCanvas.RenderSize.Width;
            double y = InCanvas.RenderSize.Height;

            ConsoleExtensions.ConsoleSplitLine(foregroundColor: ConsoleColor.DarkRed);
            InCanvas.TranslatePoint(new Point(0, 0), OutCanvas).WriteLine();
            InCanvas.TranslatePoint(new Point(x, 0), OutCanvas).WriteLine();
            InCanvas.TranslatePoint(new Point(0, y), OutCanvas).WriteLine();
            InCanvas.TranslatePoint(new Point(x, y), OutCanvas).WriteLine();
            ConsoleExtensions.ConsoleSplitLine(foregroundColor: ConsoleColor.DarkRed);
        }