Пример #1
0
        public void LogicalToRender(ref Rectangle rectangle)
        {
            Point a = new Point(rectangle.X, rectangle.Y);
            Point b = new Point(rectangle.X + rectangle.Width, rectangle.Y + rectangle.Height);

            a = logicalToRender.Transform(a);
            b = logicalToRender.Transform(b);

            Point min, max;

            if (a.X < b.X)
            {
                min.X = a.X; max.X = b.X;
            }
            else
            {
                max.X = a.X; min.X = b.X;
            }
            if (a.Y < b.Y)
            {
                min.Y = a.Y; max.Y = b.Y;
            }
            else
            {
                max.Y = a.Y; min.Y = b.Y;
            }

            rectangle.X      = min.X;
            rectangle.Y      = min.Y;
            rectangle.Width  = (max.X - min.X);
            rectangle.Height = (max.Y - min.Y);
        }
Пример #2
0
        public Point TouchToLogical(System.Drawing.PointF touch)
        {
            Point t; t.X = (int)touch.X; t.Y = (int)touch.Y;

            return(touchToLogical.Transform(t));
        }