TransformPoints() public method

public TransformPoints ( CoordinateSpace destSpace, CoordinateSpace srcSpace, Point pts ) : void
destSpace CoordinateSpace
srcSpace CoordinateSpace
pts Point
return void
Exemplo n.º 1
0
 protected PointF[] getScreenBoundsInWorldCoordinates(Graphics g)
 {
     Rectangle screenBounds = canvas.ClientRectangle;
     PointF[] transformedPoints = new PointF[] { new PointF((float)screenBounds.X, (float)screenBounds.Y), new PointF((float)screenBounds.Width, (float)screenBounds.Height) };
     g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Page, transformedPoints);
     return transformedPoints;
 }
Exemplo n.º 2
0
        private void drawGrid(System.Drawing.Size mysize)
        {
            System.Drawing.Point[]  points = new System.Drawing.Point[] { new System.Drawing.Point(mysize) };
            System.Drawing.Bitmap   image  = new System.Drawing.Bitmap(mysize.Width, mysize.Height);
            System.Drawing.Graphics newG   = System.Drawing.Graphics.FromImage(image);//this.CreateGraphics();
            newG.PageUnit = System.Drawing.GraphicsUnit.Millimeter;
            newG.TransformPoints(System.Drawing.Drawing2D.CoordinateSpace.Page, System.Drawing.Drawing2D.CoordinateSpace.Device, points);
            float gridUnit = 10;

            if (this.isShowGrid)
            {
                System.Drawing.Pen gridPen = new System.Drawing.Pen(System.Drawing.Color.Black, 0.1f);
                gridPen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;

                for (float x = 0; x < points[0].Y; x += gridUnit)
                {
                    //横线
                    newG.DrawLine(gridPen, new System.Drawing.PointF(0, x), new System.Drawing.PointF(points[0].X, x));
                }
                for (float x = 0; x < points[0].X; x += gridUnit)
                {
                    //竖线
                    newG.DrawLine(gridPen, new System.Drawing.PointF(x, 0), new System.Drawing.PointF(x, points[0].Y));
                }
            }
            if (this.isShowRuler)
            {
                //数字Y坐标
                float numberY = 2.5f;
                //数字的大小
                float fontSize = 6;
                //竖线Y坐标
                float lineY = numberY + 3f;
                //竖线高度
                float lineHeigth = 1.2f;
                //显示的数字
                int number = 0;
                //数字部分的底色
                System.Drawing.Color numberBackground = System.Drawing.Color.White;
                //竖线部分的底色
                System.Drawing.Color lineBackground = System.Drawing.Color.FromArgb(216, 231, 252);
                //画数字部分的底色
                newG.DrawRectangle(new System.Drawing.Pen(numberBackground, lineY + 0.5f), new System.Drawing.Rectangle(0, 0, points[0].X - 3, (int)numberY));
                //画竖线部分的底色
                newG.DrawRectangle(new System.Drawing.Pen(lineBackground, lineHeigth), 0, lineY, points[0].X, lineHeigth);
                for (float x = gridUnit; x < points[0].X; x += gridUnit)
                {
                    newG.DrawString(number.ToString(), new System.Drawing.Font("Times New Roman", fontSize), System.Drawing.Brushes.Black, new System.Drawing.PointF((number > 9 ? x - 1f : x - 0.5f), numberY));
                    newG.DrawLine(new System.Drawing.Pen(System.Drawing.Brushes.Black, 0.1f), new System.Drawing.PointF(x, lineY), new System.Drawing.PointF(x, lineY + lineHeigth));
                    number++;
                }
            }
            newG.Dispose();
            pbGridRuler.Size     = image.Size;
            pbGridRuler.Location = new System.Drawing.Point(0, 0);
            pbGridRuler.Image    = image;
            pbGridRuler.SendToBack();
            this.Controls.Add(pbGridRuler);
        }
Exemplo n.º 3
0
		internal static PointF docToDeviceF(Graphics g, PointF docPt)
		{
			PointF[] pts = new PointF[1] { docPt };
			g.TransformPoints(CoordinateSpace.Device,
				CoordinateSpace.World, pts);

			return pts[0];
		}
Exemplo n.º 4
0
		internal static Point docToDevice(Graphics g, PointF docPt)
		{
			PointF[] pts = new PointF[1] { new PointF(docPt.X, docPt.Y) };
			g.TransformPoints(CoordinateSpace.Device,
				CoordinateSpace.World, pts);

			return new Point((int)Math.Round(pts[0].X), (int)Math.Round(pts[0].Y));
		}
Exemplo n.º 5
0
 public override bool ContainsPoint(PointF point, Graphics g)
 {
     float x = point.X, y = point.Y;
     PointF[] pointF = { new PointF(Location.X, Location.Y) };
     g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Device, pointF);
     if (x >= pointF[0].X && (x <= pointF[0].X + Size.Width) && y >= pointF[0].Y && (y <= pointF[0].Y + Size.Height))
     {
         return true;
     }
     return false;
 }
Exemplo n.º 6
0
        private void DrawCurrentPage(Graphics oGraphics, Rectangle oBounds)
        {
            Point[] oPoints = {
                new Point(oBounds.Left, oBounds.Top),
                new Point(oBounds.Right, oBounds.Bottom)
                };
            oGraphics.TransformPoints(CoordinateSpace.Device, CoordinateSpace.Page, oPoints);

            PrintRectangle oPrintRectangle = new PrintRectangle(oPoints[0].X, oPoints[0].Y, oPoints[1].X, oPoints[1].Y);

            RangeToFormat oRangeToFormat = new RangeToFormat();
            oRangeToFormat.hdc = oRangeToFormat.hdcTarget = oGraphics.GetHdc();
            oRangeToFormat.rc = oRangeToFormat.rcPage = oPrintRectangle;
            oRangeToFormat.chrg.cpMin = _iPosition;
            oRangeToFormat.chrg.cpMax = _iPrintEnd;

            _iPosition = _oScintillaControl.NativeInterface.FormatRange(true, ref oRangeToFormat);
            
        }
Exemplo n.º 7
0
		internal static RectangleF transformRect(Graphics g,
			RectangleF r, CoordinateSpace destSpace, CoordinateSpace srcSpace)
		{
			PointF[] pts = new PointF[4];

			// get the corner points
			pts[0].X = r.Left;
			pts[0].Y = r.Top;
			pts[1].X = r.Right;
			pts[1].Y = r.Top;
			pts[2].X = r.Right;
			pts[2].Y = r.Bottom;
			pts[3].X = r.Left;
			pts[3].Y = r.Bottom;

			// get the device coordinates
			g.TransformPoints(destSpace, srcSpace, pts);

			// return rectangle in world coordinates
			return RectangleF.FromLTRB(pts[0].X, pts[0].Y, pts[2].X, pts[2].Y);
		}
Exemplo n.º 8
0
		internal static Rectangle docToDevice(Graphics g, Rectangle r)
		{
			Point[] pts = new Point[4];

			// get the corner points
			pts[0].X = r.Left;
			pts[0].Y = r.Top;
			pts[1].X = r.Right;
			pts[1].Y = r.Top;
			pts[2].X = r.Right;
			pts[2].Y = r.Bottom;
			pts[3].X = r.Left;
			pts[3].Y = r.Bottom;

			// get the device coordinates
			g.TransformPoints(CoordinateSpace.Device,
				CoordinateSpace.World, pts);

			// return rectangle in world coordinates
			return Rectangle.FromLTRB(
				pts[0].X, pts[0].Y, pts[2].X, pts[2].Y);
		}
Exemplo n.º 9
0
		/// <summary>
		/// Draw a single tick and its associated value string (TickText)
		/// </summary>
		/// <param name="g">The graphics surface on which to draw.</param>
		/// <param name="world">The tick origin in world coordinates.</param>
		/// <param name="size">The physical size of the tick (pixels)</param>
		/// <param name="text">The text (value) associated with the tick</param>
		/// <param name="clearance">out: overall perpendicular clearance from Axis</param>
		/// <param name="bounds">out: tick and tickText bounds</param>
		public virtual void DrawTick(
			Graphics g,
			double world,
			float size,
			string text,
			out float clearance,
			out Rectangle bounds)
		{
			// initialise clearance and bounds
			clearance = 0;
			bounds = Rectangle.Empty;

			if (size <= 0) { return; }		// just to be safe

			// determine physical origin of tick on axis
			PointF physical = WorldToPhysical(world, true);

			// evaluate tick start and end points
			float tickSize = size * ScaleFactor;
			float tickStart = 0;
			float tickEnd = tickSize;

			// translate points if TicksCrossAxis
			if(ticksCrossAxis){
				tickStart -= tickSize/2;
				tickEnd -= tickSize/2;
			}

			// measure tickText string, which is drawn by default with text topLeft at the origin
			SizeF sz = g.MeasureString(text, tickTextFontScaled);

			// calculate the projection of tickText rectangle onto tick vector line
			float delta = tickTextAngle - tickAngle;	// angle between tick and text (degrees)
			double r = delta * Math.PI / 180;			// convert to radians for Sin() and Cos()
			double projection = 0;
			if(!TickTextHidden){
				projection =  Math.Abs(sz.Width*Math.Cos(r)) + Math.Abs(sz.Height*Math.Sin(r));
			}

			// define centre of tickText, and overall clearance, for various tick/text scenarios
			float centre = 0;
			if(textAtTickOrigin){
				centre = tickStart - (float)projection/2;
				clearance = centre - (float)projection/2;
			}
			else{
				centre = tickEnd + (float)projection/2;
				clearance = centre + (float)projection/2;
			}

			// define tickOrigin and tickVector points along the reference X-axis
			PointF tickOrigin = new PointF(tickStart, 0);
			PointF tickVector = new PointF(tickEnd, 0);

			// set up rotation by (tickAngle+axisAngle) and translation to final position.
			// this partial transform is common to (and retained for) drawing the tickText
			g.ResetTransform();
			g.TranslateTransform(physical.X, physical.Y);	// done last (MatrixOrder.Prepend)
			g.RotateTransform(-tickAngle-physicalAngle);	// done first

			// draw tick line
			g.DrawLine(linePen, tickOrigin, tickVector);

			// Set up and transform tick extents to define initial bounds
			PointF[] tickX = new PointF[2];

			tickX[0] = tickOrigin;
			tickX[1] = tickVector;
			g.TransformPoints(CoordinateSpace.Device, CoordinateSpace.World, tickX);

			// adjust clearance because of tick rotation 
			clearance = clearance * (float)Math.Abs( Math.Sin(tickAngle * Math.PI/180) );

			// set initial bounds to rectangle enclosing tick
			bounds = Rectangle.Round( Utils.NormalisedRectangleF( tickX[0], tickX[1]) );

			if(text == "" || TickTextHidden){ return; }		// return now if no tickText to draw

			// add further graphic transforms (in reverse order) to align and draw tickText
			g.TranslateTransform(centre, 0);					// (3) translate to text centre
			g.RotateTransform(-delta);							// (2) align with tick vector
			g.TranslateTransform(-sz.Width/2, -sz.Height/2);	// (1) centre text prior to rotation
 
			// draw label at the origin (0,0) using accumulated transforms
			g.DrawString(text, tickTextFontScaled, tickTextBrush, PointF.Empty);

			// Set up tickText rectangle extents to define overall bounds
			PointF[] textX = new PointF[4];

			textX[0] = new PointF(0, 0);					// origin of rectangle
			textX[1] = new PointF(sz.Width, sz.Height);		// bottom Right corner
			textX[2] = new PointF(sz.Width, 0);				// top Right corner
			textX[3] = new PointF(0, sz.Height);			// bottom Left corner
 
			// transform to final text position and orientation
			g.TransformPoints(CoordinateSpace.Device, CoordinateSpace.World, textX);

			// evaluate the normalised rectangle from each opposing diagonal
			RectangleF r1 = Utils.NormalisedRectangleF( textX[0], textX[1] );
			RectangleF r2 = Utils.NormalisedRectangleF( textX[2], textX[3] );

			// combine rectangles for overall text bounds
			Rectangle textBounds = Rectangle.Round( RectangleF.Union(r1,r2) );
 
			// combine current tickBounds and TextBounds
			bounds = Rectangle.Union( bounds, textBounds );

			g.ResetTransform();			// clear current graphics transform matrix

		}
Exemplo n.º 10
0
		/// <summary>
		/// Converts overview's document's coordinates to screen coordinates.
		/// </summary>
		internal Point DocToScreen(Graphics g, PointF pt)
		{
			PointF[] points = new PointF[1] { pt };
			g.TransformPoints(CoordinateSpace.Device, CoordinateSpace.World, points);
			return new Point((int)points[0].X, (int)points[0].Y);
		}
Exemplo n.º 11
0
        private void DrawCurrentPage(Graphics oGraphics, Rectangle oBounds) {
            Point[] oPoints = {
                new Point(oBounds.Left, oBounds.Top),
                new Point(oBounds.Right, oBounds.Bottom)
                };
            oGraphics.TransformPoints(CoordinateSpace.Device, CoordinateSpace.Page, oPoints);

            PrintRectangle oPrintRectangle = new PrintRectangle(oPoints[0].X, oPoints[0].Y, oPoints[1].X, oPoints[1].Y);

            RangeToFormat oRangeToFormat = new RangeToFormat();
            oRangeToFormat.hdc = oRangeToFormat.hdcTarget = oGraphics.GetHdc();
            oRangeToFormat.rc = oRangeToFormat.rcPage = oPrintRectangle;
            oRangeToFormat.chrg.cpMin = m_iLastPrintPosition;
            oRangeToFormat.chrg.cpMax = m_iTextLength;

            m_iLastPrintPosition += FormatRange(oRangeToFormat);
        }
Exemplo n.º 12
0
		internal static void docToDevice(Graphics g,
			float docX, float docY, ref int devX, ref int devY)
		{
			PointF[] pts = new PointF[1] { new PointF(docX, docY) };
			g.TransformPoints(CoordinateSpace.Device,
				CoordinateSpace.World, pts);

			devX = (int)(pts[0].X);
			devY = (int)(pts[0].Y);
		}
Exemplo n.º 13
0
		internal static SizeF docToDeviceF(Graphics g, SizeF size)
		{
			PointF[] pts = new PointF[2] {
				new PointF(0, 0), new PointF(size.Width, size.Height) };
			g.TransformPoints(CoordinateSpace.Device,
				CoordinateSpace.World, pts);

			return new SizeF(pts[1].X - pts[0].X, pts[1].Y - pts[0].Y);
		}
Exemplo n.º 14
0
 // Get real printer page bounds in units of 1/100th of an inch
 static Rectangle GetRealPageBounds(Graphics g)
 {
     RectangleF vpb = g.VisibleClipBounds;
     PointF[] bottomRight = { new PointF(vpb.Size.Width, vpb.Size.Height) };
     g.TransformPoints(CoordinateSpace.Device, CoordinateSpace.Page, bottomRight);
     float dpiX = g.DpiX;
     float dpiY = g.DpiY;
     return new Rectangle(0, 0, (int)(bottomRight[0].X * 100 / dpiX), (int)(bottomRight[0].Y * 100 / dpiY));
 }
Exemplo n.º 15
0
 // Translate from units of 1/100th of an inch to page units
 static RectangleF TranslateBounds(Graphics g, Rectangle bounds)
 {
     float dpiX = g.DpiX;
     float dpiY = g.DpiY;
     PointF[] pts = new PointF[2];
     // Translate from units of 1/100th of an inch to device units
     pts[0] = new PointF(bounds.X * dpiX / 100, bounds.Y * dpiY / 100);
     pts[1] = new PointF(bounds.Width * dpiX / 100, bounds.Height * dpiX / 100);
     // Translate from device units to page units
     g.TransformPoints(CoordinateSpace.Page, CoordinateSpace.Device, pts);
     return new RectangleF(pts[0].X, pts[0].Y, pts[1].X, pts[1].Y);
 }
Exemplo n.º 16
0
        private void DrawCurrentPage(Graphics gr, Rectangle bounds)
        {
            Point[] oPoints = {
                new Point(bounds.Left, bounds.Top),
                new Point(bounds.Right, bounds.Bottom)
                };
            gr.TransformPoints(CoordinateSpace.Device, CoordinateSpace.Page, oPoints);

            PrintRectangle oPrintRectangle = new PrintRectangle(oPoints[0].X, oPoints[0].Y, oPoints[1].X, oPoints[1].Y);

            RangeToFormat oRangeToFormat = new RangeToFormat();
            oRangeToFormat.hdc = oRangeToFormat.hdcTarget = gr.GetHdc();
            oRangeToFormat.rc = oRangeToFormat.rcPage = oPrintRectangle;
            oRangeToFormat.chrg.Min = _iPosition;
            oRangeToFormat.chrg.Max = _iPrintEnd;
            _iPosition = sci.FormatRange(true, ref oRangeToFormat);
        }
Exemplo n.º 17
0
        public void Draw(Graphics g)
        {
            ptCurva = new Point[2];
            ptCurva[0] = new Point((int)x, (int)y);

            float incX, incY;
            g.TranslateTransform(x, y);
            g.RotateTransform(angle);

            double rad = angle * Math.PI / 180f;
            if(speed > 0)
            {
                if (Math.Abs(WheelAngle) < 0.0001f)
                {
                    incX = (float)Math.Cos(rad);
                    incY = (float)Math.Sin(rad);
                    x += incX * speed;
                    y += incY * speed;
                    g.TranslateTransform(incX, incY);
                }
                else
                {
                    Point[] pts = { new Point(0, 0) };
                    float newRadius = (float)(radius * Math.Tan((90 - WheelAngle) * Math.PI / 180f));
                    float totalAngle = (float)((360 * speed) / (2 * Math.PI * newRadius));
                    g.TranslateTransform(0, newRadius);
                    g.RotateTransform(totalAngle);
                    g.TranslateTransform(0, -newRadius);
                    g.TransformPoints(CoordinateSpace.Page, CoordinateSpace.World, pts);

                    x = pts[0].X;
                    y = pts[0].Y;
                    angle = (angle + totalAngle) % 360f;
                }
            }
            Pen p = new Pen(Color.Red);
            g.DrawLine(p, -50f, 0, 70f, 0);
            g.DrawLine(p, 0, -5f, 0, 5f);
            g.TranslateTransform(-(widthW / 2 + distFB), -width/2);
            foreach (Wheel w in wheels)
            {
                w.Draw(g);
            }
            g.DrawRectangle(new Pen(Color.Blue), 0, 0, length, width);
            g.ResetTransform();
            ptCurva[1] = new Point((int)x, (int)y);
        }
Exemplo n.º 18
0
    ConvertPixelsAndPoints
    (
        Boolean bPixelsToPoints,
        Graphics oGraphics,
        Single fWidthIn,
        Single fHeightIn,
        out Single fWidthOut,
        out Single fHeightOut
    )
    {
        Debug.Assert(oGraphics != null);
        Debug.Assert(fWidthIn >= 0);
        Debug.Assert(fHeightIn >= 0);

        // Switch the page unit to points.

        GraphicsUnit oOldPageUnit = oGraphics.PageUnit;
        oGraphics.PageUnit = GraphicsUnit.Point;

        // Create an array of one point.

        PointF [] aoPointF = new PointF[1] { new PointF(fWidthIn, fHeightIn) };

        // Convert the point from pixels to points, or vice versa.

        if (bPixelsToPoints)
        {
            oGraphics.TransformPoints(
                CoordinateSpace.Page, CoordinateSpace.Device, aoPointF);
        }
        else
        {
            oGraphics.TransformPoints(
                CoordinateSpace.Device, CoordinateSpace.Page, aoPointF);
        }

        fWidthOut = aoPointF[0].X;
        fHeightOut = aoPointF[0].Y;

        // Restore the page unit.

        oGraphics.PageUnit = oOldPageUnit;
    }
Exemplo n.º 19
0
        /// <summary>
        ///		Renders the chart
        /// </summary>
        /// <param name="graphics">Graphics object to output the drawing</param>
        /// <param name="width">Specifies the Width of the chart</param>
        /// <param name="height">Specifies the height of the chart</param>
        public override void Render(System.Drawing.Graphics graphics, int width, int height)
        {
            ChartEngine engine = this.Engine;
            float       scaleX = engine.ScaleX, scaleY = engine.ScaleY;
            Pen         pen   = this.Line.GetPen(graphics);
            Brush       brush = this.Fill.GetBrush(graphics);

            float xStart = 0, xWidth;

            int xCount = 0, xPosFinal = 0;

            if (engine.Charts.Count > 1)
            {
                foreach (Chart c in engine.Charts)
                {
                    if (c.Equals(this))
                    {
                        xPosFinal = xCount;
                    }
                    if (c as MapColumnChart != null)
                    {
                        xCount++;
                    }
                }
                xWidth = ((scaleX - 1) / xCount);
                xStart = xWidth * xPosFinal + 1;
            }
            else
            {
                xStart = 1;
                xWidth = scaleX;
            }

            float y;
            float yHeight;
            float x = 0;

            foreach (ChartPoint p in this.Data)
            {
                if (p.YValue * scaleY < 0)
                {
                    y       = (p.YValue * scaleY);
                    yHeight = -(p.YValue * scaleY);
                }

                else
                {
                    y       = 0;
                    yHeight = (p.YValue * scaleY);
                }
                Rectangle rect = new Rectangle(
                    (int)((float)(x * scaleX) + xStart),
                    (int)y,
                    (int)xWidth,
                    (int)yHeight);

                Point [] points = new Point[] { rect.Location };
                graphics.TransformPoints(
                    System.Drawing.Drawing2D.CoordinateSpace.Page,
                    System.Drawing.Drawing2D.CoordinateSpace.World,
                    points);

                if (this.rects != null)
                {
                    this.rects.Add(
                        new Rectangle(
                            points[0], new Size((int)xWidth, (int)yHeight))
                        );
                }
                graphics.FillRectangle(brush, rect);
                graphics.DrawRectangle(pen, rect);
                x++;
            }
        }
Exemplo n.º 20
0
 public static void ConvertToWorld(Graphics g, ref PointF[] pointArray)
 {
     g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Page, pointArray);
 }
Exemplo n.º 21
0
 float GetMinResolution(Graphics g)
 {
     // Determine pixel size in world coordinates.
     PointF[] pts = {new PointF(0,0), new PointF(1, 0)};
     g.TransformPoints(CoordinateSpace.World, CoordinateSpace.Device, pts);
     return Util.DistanceF(pts[0], pts[1]);
 }
Exemplo n.º 22
0
		private void TransformsTestDraw(Graphics g)
		{
			g.FillRectangle(SystemBrushes.Control, tabPage15.ClientRectangle);
			boundsX = boundsY = boundsPad;
			using (Pen p = new Pen(Color.Blue))
			{

				int mid = (Height-50)/2;
				if (mid > (Width-10)/2)
					mid = (Width-10)/2;
				
				PointF[] f = (PointF[])transformTestPoints.Clone();
				g.RotateTransform(transformRotation);
				g.TranslateTransform(transformX, transformY);
				g.ScaleTransform(transformScaleX, transformScaleY);
				g.TransformPoints(CoordinateSpace.Page,
					CoordinateSpace.World,
					f);

				using (Brush b = new SolidBrush(Color.CadetBlue))
				{
					g.FillEllipse(b, -20, -20, 20, 10);
					g.DrawString("Hello", Font, b, 0, 0);
				}
				g.ResetTransform();

				if (transformX < -200 || transformX > 200)
				{
					transformXOffset = -transformXOffset;
					transformScaleXOffset = -transformScaleXOffset;
				}

				if (transformY < -200 || transformY > 200)
				{
					transformYOffset = -transformYOffset;
					transformScaleYOffset = -transformScaleYOffset;
				}

				for (int i = 0; i < transformTestPoints.Length; i+=2)
					g.DrawLine(p, f[i].X + mid, f[i].Y + mid, f[i+1].X + mid, f[i+1].Y + mid);

				transformX += transformXOffset;
				transformY += transformYOffset;
				transformRotation += transformRotationOffSet;
				transformScaleX += transformScaleXOffset;
				transformScaleY += transformScaleYOffset;

				/*				Font f = new Font("Arial", 6);
				
								Rectangle b = NextBounds(g, "Rectangle");
								Rectangle b1 = new Rectangle(b.Left + 5, b.Top + 5, b.Width - 10, b.Height - 10);
								g.DrawRectangle(p, b1);
				
								g.RotateTransform(45);
								b = NextBounds(g, "RotateTransform(45)");
								b1 = new Rectangle(b.Left + 5, b.Top + 5, b.Width - 10, b.Height - 10);
								g.DrawRectangle(p, b1);
				*/				

			}
			
		}
Exemplo n.º 23
0
		/// <summary>
		/// Inherited from Flowchart source
		/// </summary>
		/// <param name="g"></param>
		/// <param name="r"></param>
		/// <returns></returns>
		public static RectangleF deviceToDoc(Graphics g, RectangleF r)
		{
			PointF[] pts = new PointF[4];

			// get the corner points
			pts[0].X = r.Left;
			pts[0].Y = r.Top;
			pts[1].X = r.Right;
			pts[1].Y = r.Top;
			pts[2].X = r.Right;
			pts[2].Y = r.Bottom;
			pts[3].X = r.Left;
			pts[3].Y = r.Bottom;

			// get the world coordinates
			g.TransformPoints(CoordinateSpace.World,
				CoordinateSpace.Device, pts);

			// return rectangle in world coordinates
			return RectangleF.FromLTRB(
				pts[0].X, pts[0].Y, pts[2].X, pts[2].Y);
		}
Exemplo n.º 24
0
		internal static PointF deviceToDoc(Graphics g, Point devPoint)
		{
			PointF[] pts = new PointF[1] { new PointF(devPoint.X, devPoint.Y) };
			g.TransformPoints(CoordinateSpace.World,
				CoordinateSpace.Device, pts);

			return pts[0];
		}