/// <summary> /// Transform this <see cref="Location"/> object to display device coordinates using the properties of the specified <see cref="GraphPane"/>. /// </summary> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that contains the <see cref="Axis"/> classes which will be used for the /// transform. /// </param> /// <returns> /// A point in display device coordinates that corresponds to the specified user point. /// </returns> public PointF Transform(PaneBase pane) { return Transform(pane, this._x, this._y, this._coordinateFrame); }
/// <summary> /// Render this object to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { // Convert the arrow coordinates from the user coordinate system // to the screen coordinate system PointF pix1 = this.Location.TransformTopLeft(pane); PointF pix2 = this.Location.TransformBottomRight(pane); if (pix1.X > -10000 && pix1.X < 100000 && pix1.Y > -100000 && pix1.Y < 100000 && pix2.X > -10000 && pix2.X < 100000 && pix2.Y > -100000 && pix2.Y < 100000) { // get a scaled size for the arrowhead float scaledSize = this._size * scaleFactor; // calculate the length and the angle of the arrow "vector" double dy = pix2.Y - pix1.Y; double dx = pix2.X - pix1.X; float angle = (float)Math.Atan2(dy, dx) * 180.0F / (float)Math.PI; float length = (float)Math.Sqrt(dx * dx + dy * dy); // Save the old transform matrix Matrix transform = g.Transform; // Move the coordinate system so it is located at the starting point // of this arrow g.TranslateTransform(pix1.X, pix1.Y); // Rotate the coordinate system according to the angle of this arrow // about the starting point g.RotateTransform(angle); // get a pen according to this arrow properties using (Pen pen = this._line.GetPen(pane, scaleFactor)) { // new Pen( _color, pane.ScaledPenWidth( _penWidth, scaleFactor ) ) ) // pen.DashStyle = _style; // Only show the arrowhead if required if (this._isArrowHead) { // Draw the line segment for this arrow g.DrawLine(pen, 0, 0, length - scaledSize + 1, 0); // Create a polygon representing the arrowhead based on the scaled // size PointF[] polyPt = new PointF[4]; float hsize = scaledSize / 3.0F; polyPt[0].X = length; polyPt[0].Y = 0; polyPt[1].X = length - scaledSize; polyPt[1].Y = hsize; polyPt[2].X = length - scaledSize; polyPt[2].Y = -hsize; polyPt[3] = polyPt[0]; using (SolidBrush brush = new SolidBrush(this._line._color)) // render the arrowhead g.FillPolygon(brush, polyPt); } else { g.DrawLine(pen, 0, 0, length, 0); } } // Restore the transform matrix back to its original RequestState g.Transform = transform; } }
/// <summary> /// Determine if the specified screen point lies inside the bounding box of this /// <see cref="PolyObj"/>. /// </summary> /// <param name="pt"> /// The screen point, in pixels /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <returns> /// true if the point lies in the bounding box, false otherwise /// </returns> public override bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor) { if (this._points != null && this._points.Length > 1) { if (!base.PointInBox(pt, pane, g, scaleFactor)) { return false; } using (GraphicsPath path = this.MakePath(pane)) return path.IsVisible(pt); } return false; }
/// <summary> /// Calculate the <see cref="Legend"/> rectangle (<see cref="Rect"/>), taking into account the number of required legend entries, and the legend /// drawing preferences. /// </summary> /// <remarks> /// Adjust the size of the /// <see cref="Chart.Rect"/> for the parent <see cref="GraphPane"/> to accomodate the space required by the legend. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <param name="tChartRect"> /// The rectangle that contains the area bounded by the axes, in pixel units. /// <seealso cref="Chart.Rect"/> /// </param> public void CalcRect(Graphics g, PaneBase pane, float scaleFactor, ref RectangleF tChartRect) { // Start with an empty rectangle this._rect = Rectangle.Empty; this._hStack = 1; this._legendItemWidth = 1; this._legendItemHeight = 0; RectangleF clientRect = pane.CalcClientRect(g, scaleFactor); // If the legend is invisible, don't do anything if (!this._isVisible) { return; } int nCurve = 0; PaneList paneList = this.GetPaneList(pane); this._tmpSize = this.GetMaxHeight(paneList, g, scaleFactor); float halfGap = this._tmpSize / 2.0F, maxWidth = 0, tmpWidth, gapPix = this._gap * this._tmpSize; foreach (GraphPane tmpPane in paneList) { // Loop through each curve in the curve list // Find the maximum width of the legend labels // foreach ( CurveItem curve in tmpPane.CurveList ) // foreach ( CurveItem curve in GetIterator( tmpPane.CurveList, _isReverse ) ) int count = tmpPane.CurveList.Count; for (int i = 0; i < count; i++) { CurveItem curve = tmpPane.CurveList[this._isReverse ? count - i - 1 : i]; if (curve._label._text != string.Empty && curve._label._isVisible) { // Calculate the width of the label save the max width FontSpec tmpFont = (curve._label._fontSpec != null) ? curve._label._fontSpec : this.FontSpec; tmpWidth = tmpFont.GetWidth(g, curve._label._text, scaleFactor); if (tmpWidth > maxWidth) { maxWidth = tmpWidth; } // Save the maximum symbol height for line-type curves if (curve is LineItem && ((LineItem)curve).Symbol.Size > this._legendItemHeight) { this._legendItemHeight = ((LineItem)curve).Symbol.Size; } nCurve++; } } if (pane is MasterPane && ((MasterPane)pane).IsUniformLegendEntries) { break; } } float widthAvail; // Is this legend horizontally stacked? if (this._isHStack) { // Determine the available space for horizontal stacking switch (this._position) { // Never stack if the legend is to the right or left case LegendPos.Right: case LegendPos.Left: widthAvail = 0; break; // for the top & bottom, the axis border width is available case LegendPos.Top: case LegendPos.TopCenter: case LegendPos.Bottom: case LegendPos.BottomCenter: widthAvail = tChartRect.Width; break; // for the top & bottom flush left, the panerect less margins is available case LegendPos.TopFlushLeft: case LegendPos.BottomFlushLeft: widthAvail = clientRect.Width; break; // for inside the axis area or Float, use 1/2 of the axis border width case LegendPos.InsideTopRight: case LegendPos.InsideTopLeft: case LegendPos.InsideBotRight: case LegendPos.InsideBotLeft: case LegendPos.Float: widthAvail = tChartRect.Width / 2; break; // shouldn't ever happen default: widthAvail = 0; break; } // width of one legend entry if (this._isShowLegendSymbols) { this._legendItemWidth = 3.0f * this._tmpSize + maxWidth; } else { this._legendItemWidth = 0.5f * this._tmpSize + maxWidth; } // Calculate the number of columns in the legend // Normally, the legend is: // available width / ( max width of any entry + space for line&symbol ) if (maxWidth > 0) { this._hStack = (int)((widthAvail - halfGap) / this._legendItemWidth); } // You can never have more columns than legend entries if (this._hStack > nCurve) { this._hStack = nCurve; } // a saftey check if (this._hStack == 0) { this._hStack = 1; } } else { if (this._isShowLegendSymbols) { this._legendItemWidth = 3.0F * this._tmpSize + maxWidth; } else { this._legendItemWidth = 0.5F * this._tmpSize + maxWidth; } } // legend is: // item: space line space text space // width: wid 4*wid wid maxWid wid // The symbol is centered on the line // legend begins 3 * wid to the right of the plot rect // The height of the legend is the actual height of the lines of text // (nCurve * hite) plus wid on top and wid on the bottom // total legend width float totLegWidth = this._hStack * this._legendItemWidth; // The total legend height this._legendItemHeight = this._legendItemHeight * scaleFactor + halfGap; if (this._tmpSize > this._legendItemHeight) { this._legendItemHeight = this._tmpSize; } float totLegHeight = (float)Math.Ceiling(nCurve / (double)this._hStack) * this._legendItemHeight; RectangleF newRect = new RectangleF(); // Now calculate the legend rect based on the above determined parameters // Also, adjust the ChartRect to reflect the space for the legend if (nCurve > 0) { newRect = new RectangleF(0, 0, totLegWidth, totLegHeight); // The switch statement assigns the left and top edges, and adjusts the ChartRect // as required. The right and bottom edges are calculated at the bottom of the switch. switch (this._position) { case LegendPos.Right: newRect.X = clientRect.Right - totLegWidth; newRect.Y = tChartRect.Top; tChartRect.Width -= totLegWidth + gapPix; break; case LegendPos.Top: newRect.X = tChartRect.Left; newRect.Y = clientRect.Top; tChartRect.Y += totLegHeight + gapPix; tChartRect.Height -= totLegHeight + gapPix; break; case LegendPos.TopFlushLeft: newRect.X = clientRect.Left; newRect.Y = clientRect.Top; tChartRect.Y += totLegHeight + gapPix * 1.5f; tChartRect.Height -= totLegHeight + gapPix * 1.5f; break; case LegendPos.TopCenter: newRect.X = tChartRect.Left + (tChartRect.Width - totLegWidth) / 2; newRect.Y = tChartRect.Top; tChartRect.Y += totLegHeight + gapPix; tChartRect.Height -= totLegHeight + gapPix; break; case LegendPos.Bottom: newRect.X = tChartRect.Left; newRect.Y = clientRect.Bottom - totLegHeight; tChartRect.Height -= totLegHeight + gapPix; break; case LegendPos.BottomFlushLeft: newRect.X = clientRect.Left; newRect.Y = clientRect.Bottom - totLegHeight; tChartRect.Height -= totLegHeight + gapPix; break; case LegendPos.BottomCenter: newRect.X = tChartRect.Left + (tChartRect.Width - totLegWidth) / 2; newRect.Y = clientRect.Bottom - totLegHeight; tChartRect.Height -= totLegHeight + gapPix; break; case LegendPos.Left: newRect.X = clientRect.Left; newRect.Y = tChartRect.Top; tChartRect.X += totLegWidth + halfGap; tChartRect.Width -= totLegWidth + gapPix; break; case LegendPos.InsideTopRight: newRect.X = tChartRect.Right - totLegWidth; newRect.Y = tChartRect.Top; break; case LegendPos.InsideTopLeft: newRect.X = tChartRect.Left; newRect.Y = tChartRect.Top; break; case LegendPos.InsideBotRight: newRect.X = tChartRect.Right - totLegWidth; newRect.Y = tChartRect.Bottom - totLegHeight; break; case LegendPos.InsideBotLeft: newRect.X = tChartRect.Left; newRect.Y = tChartRect.Bottom - totLegHeight; break; case LegendPos.Float: newRect.Location = this.Location.TransformTopLeft(pane, totLegWidth, totLegHeight); break; } } this._rect = newRect; }
/// <summary> /// Determine if a mouse point is within the legend, and if so, which legend entry (<see cref="CurveItem"/>) is nearest. /// </summary> /// <param name="mousePt"> /// The screen point, in pixel coordinates. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <param name="index"> /// The index number of the <see cref="CurveItem"/> legend entry that is under the mouse point. The <see cref="CurveItem"/> object is accessible via /// <see cref="GraphPane.CurveList">CurveList[index]</see>. /// </param> /// <returns> /// true if the mouse point is within the <see cref="Legend"/> bounding box, false otherwise. /// </returns> /// <seealso cref="GraphPane.FindNearestObject"/> public bool FindPoint(PointF mousePt, PaneBase pane, float scaleFactor, out int index) { index = -1; if (this._rect.Contains(mousePt)) { int j = (int)((mousePt.Y - this._rect.Top) / this._legendItemHeight); int i = (int)((mousePt.X - this._rect.Left - this._tmpSize / 2.0f) / this._legendItemWidth); if (i < 0) { i = 0; } if (i >= this._hStack) { i = this._hStack - 1; } int pos = i + j * this._hStack; index = 0; PaneList paneList = this.GetPaneList(pane); foreach (GraphPane tmpPane in paneList) { foreach (CurveItem curve in tmpPane.CurveList) { if (curve._label._isVisible && curve._label._text != string.Empty) { if (pos == 0) { return true; } pos--; } index++; } } return true; } return false; }
/// <summary> /// Render this <see cref="GraphObj"/> object to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="PaneBase"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public abstract void Draw(Graphics g, PaneBase pane, float scaleFactor);
/// <summary> /// Determine if the specified screen point lies inside the bounding box of this /// <see cref="GraphObj"/>. /// </summary> /// <param name="pt"> /// The screen point, in pixels /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="PaneBase"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <returns> /// true if the point lies in the bounding box, false otherwise /// </returns> public virtual bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor) { GraphPane gPane = pane as GraphPane; if (gPane != null && this._isClippedToChartRect && !gPane.Chart.Rect.Contains(pt)) { return false; } return true; }
/// <summary> /// Render the specified <paramref name="text"/> to the specifed /// <see cref="Graphics"/> device. The text, border, and fill options will be rendered as required. /// </summary> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="text"> /// A string value containing the text to be displayed. This can be multiple lines, separated by newline ('\n') characters /// </param> /// <param name="x"> /// The X location to display the text, in screen coordinates, relative to the horizontal (<see cref="AlignH"/>) alignment parameter /// <paramref name="alignH"/> /// </param> /// <param name="y"> /// The Y location to display the text, in screen coordinates, relative to the vertical (<see cref="AlignV"/> /// alignment parameter <paramref name="alignV"/> /// </param> /// <param name="alignH"> /// A horizontal alignment parameter specified using the <see cref="AlignH"/> enum type /// </param> /// <param name="alignV"> /// A vertical alignment parameter specified using the <see cref="AlignV"/> enum type /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <param name="layoutArea"> /// The limiting area (<see cref="SizeF"/>) into which the text must fit. The actual rectangle may be smaller than this, but the text will be wrapped /// to accomodate the area. /// </param> public void Draw(Graphics g, PaneBase pane, string text, float x, float y, AlignH alignH, AlignV alignV, float scaleFactor, SizeF layoutArea) { // make sure the font size is properly scaled // Remake( scaleFactor, this.Size, ref this.scaledSize, ref this.font ); SmoothingMode sModeSave = g.SmoothingMode; TextRenderingHint sHintSave = g.TextRenderingHint; if (this._isAntiAlias) { g.SmoothingMode = SmoothingMode.HighQuality; g.TextRenderingHint = TextRenderingHint.AntiAlias; } SizeF sizeF; if (layoutArea.IsEmpty) { sizeF = this.MeasureString(g, text, scaleFactor); } else { sizeF = this.MeasureString(g, text, scaleFactor, layoutArea); } // Save the old transform matrix for later restoration Matrix saveMatrix = g.Transform; g.Transform = this.SetupMatrix(g.Transform, x, y, sizeF, alignH, alignV, this._angle); // Create a rectangle representing the border around the // text. Note that, while the text is drawn based on the // TopCenter position, the rectangle is drawn based on // the TopLeft position. Therefore, move the rectangle // width/2 to the left to align it properly RectangleF rectF = new RectangleF(-sizeF.Width / 2.0F, 0.0F, sizeF.Width, sizeF.Height); // If the background is to be filled, fill it this._fill.Draw(g, rectF); // Draw the border around the text if required this._border.Draw(g, pane, scaleFactor, rectF); // make a center justified StringFormat alignment // for drawing the text StringFormat strFormat = new StringFormat(); strFormat.Alignment = this._stringAlignment; // if ( this.stringAlignment == StringAlignment.Far ) // g.TranslateTransform( sizeF.Width / 2.0F, 0F, MatrixOrder.Prepend ); // else if ( this.stringAlignment == StringAlignment.Near ) // g.TranslateTransform( -sizeF.Width / 2.0F, 0F, MatrixOrder.Prepend ); // Draw the drop shadow text. Note that the coordinate system // is set up such that 0,0 is at the location where the // CenterTop of the text needs to be. if (this._isDropShadow) { float xShift = (float)(Math.Cos(this._dropShadowAngle) * this._dropShadowOffset * this._font.Height); float yShift = (float)(Math.Sin(this._dropShadowAngle) * this._dropShadowOffset * this._font.Height); RectangleF rectD = rectF; rectD.Offset(xShift, yShift); // make a solid brush for rendering the font itself using (SolidBrush brushD = new SolidBrush(this._dropShadowColor)) g.DrawString(text, this._font, brushD, rectD, strFormat); } // make a solid brush for rendering the font itself using (SolidBrush brush = new SolidBrush(this._fontColor)) { // Draw the actual text. Note that the coordinate system // is set up such that 0,0 is at the location where the // CenterTop of the text needs to be. // RectangleF layoutArea = new RectangleF( 0.0F, 0.0F, sizeF.Width, sizeF.Height ); g.DrawString(text, this._font, brush, rectF, strFormat); } // Restore the transform matrix back to original g.Transform = saveMatrix; g.SmoothingMode = sModeSave; g.TextRenderingHint = sHintSave; }
/// <summary> /// Render this <see cref="TextObj"/> object to the specified <see cref="Graphics"/> device This method is normally only called by the Draw method of /// the parent <see cref="GraphObjList"/> collection object. /// </summary> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { // transform the x,y location from the user-defined // coordinate frame to the screen pixel location PointF pix = this._location.Transform(pane); // Draw the text on the screen, including any frame and background // fill elements if (pix.X > -100000 && pix.X < 100000 && pix.Y > -100000 && pix.Y < 100000) { // if ( this.layoutSize.IsEmpty ) // this.FontSpec.Draw( g, pane.IsPenWidthScaled, this.text, pix.X, pix.Y, // this.location.AlignH, this.location.AlignV, scaleFactor ); // else this.FontSpec.Draw(g, pane, this._text, pix.X, pix.Y, this._location.AlignH, this._location.AlignV, scaleFactor, this._layoutArea); } }
/// <summary> /// The <see cref="PointF"/> for this object as defined by the /// <see cref="X"/> and <see cref="Y"/> /// properties. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <remarks> /// This method transforms the location to output device pixel units. The <see cref="AlignH"/> and <see cref="AlignV"/> properties are ignored for this /// transformation (see <see cref="TransformTopLeft(PaneBase,float,float)"/>). /// </remarks> /// <value> /// A <see cref="PointF"/> in pixel units. /// </value> /// <returns> /// The <see cref="PointF"/>. /// </returns> public PointF TransformTopLeft(PaneBase pane) { return this.Transform(pane); }
/// <summary> /// Render the specified <paramref name="text"/> to the specifed /// <see cref="Graphics"/> device. The text, border, and fill options will be rendered as required. /// </summary> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="text"> /// A string value containing the text to be displayed. This can be multiple lines, separated by newline ('\n') characters /// </param> /// <param name="x"> /// The X location to display the text, in screen coordinates, relative to the horizontal (<see cref="AlignH"/>) alignment parameter /// <paramref name="alignH"/> /// </param> /// <param name="y"> /// The Y location to display the text, in screen coordinates, relative to the vertical (<see cref="AlignV"/> /// alignment parameter <paramref name="alignV"/> /// </param> /// <param name="alignH"> /// A horizontal alignment parameter specified using the <see cref="AlignH"/> enum type /// </param> /// <param name="alignV"> /// A vertical alignment parameter specified using the <see cref="AlignV"/> enum type /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public void Draw(Graphics g, PaneBase pane, string text, float x, float y, AlignH alignH, AlignV alignV, float scaleFactor) { this.Draw(g, pane, text, x, y, alignH, alignV, scaleFactor, new SizeF()); }
/// <summary> /// Transform this <see cref="Location"/> from the coordinate system as specified by <see cref="CoordinateFrame"/> to the device coordinates of the /// specified <see cref="PaneBase"/> object. /// </summary> /// <remarks> /// The returned /// <see cref="PointF"/> struct represents the top-left corner of the object that honors the <see cref="Location"/> properties. The /// <see cref="AlignH"/> and <see cref="AlignV"/> properties are honored in this transformation. /// </remarks> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that contains the <see cref="Axis"/> classes which will be used for the /// transform. /// </param> /// <param name="width"> /// The width of the object in device pixels /// </param> /// <param name="height"> /// The height of the object in device pixels /// </param> /// <returns> /// The top-left corner of the object /// </returns> public PointF TransformTopLeft(PaneBase pane, float width, float height) { PointF pt = this.Transform(pane); if (this._alignH == AlignH.Right) { pt.X -= width; } else if (this._alignH == AlignH.Center) { pt.X -= width / 2.0F; } if (this._alignV == AlignV.Bottom) { pt.Y -= height; } else if (this._alignV == AlignV.Center) { pt.Y -= height / 2.0F; } return pt; }
/// <summary> /// Transform the <see cref="RectangleF"/> for this object as defined by the /// <see cref="X"/>, <see cref="Y"/>, <see cref="Width"/>, and /// <see cref="Height"/> properties. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <remarks> /// This method transforms the location to output device pixel units. The <see cref="AlignH"/> and <see cref="AlignV"/> properties are honored in this /// transformation. /// </remarks> /// <value> /// A <see cref="RectangleF"/> in pixel units. /// </value> /// <returns> /// The <see cref="RectangleF"/>. /// </returns> public RectangleF TransformRect(PaneBase pane) { PointF pix1 = this.TransformTopLeft(pane); PointF pix2 = this.TransformBottomRight(pane); // PointF pix3 = TransformTopLeft( pane, pix2.X - pix1.X, pix2.Y - pix1.Y ); return new RectangleF(pix1.X, pix1.Y, Math.Abs(pix2.X - pix1.X), Math.Abs(pix2.Y - pix1.Y)); }
/// <summary> /// The <see cref="PointF"/> for this object as defined by the /// <see cref="X2"/> and <see cref="Y2"/> properties. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <remarks> /// This method transforms the location to output device pixel units. The <see cref="AlignH"/> and <see cref="AlignV"/> properties are ignored for this /// transformation (see <see cref="TransformTopLeft(PaneBase,float,float)"/>). /// </remarks> /// <value> /// A <see cref="PointF"/> in pixel units. /// </value> /// <returns> /// The <see cref="PointF"/>. /// </returns> public PointF TransformBottomRight(PaneBase pane) { return Transform(pane, this.X2, this.Y2, this._coordinateFrame); }
/// <summary> /// Determines the shape type and Coords values for this GraphObj /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <param name="g"> /// The g. /// </param> /// <param name="scaleFactor"> /// The scale Factor. /// </param> /// <param name="shape"> /// The shape. /// </param> /// <param name="coords"> /// The coords. /// </param> public override void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords) { // transform the x,y location from the user-defined // coordinate frame to the screen pixel location RectangleF pixRect = this._location.TransformRect(pane); shape = "rect"; coords = string.Format("{0:f0},{1:f0},{2:f0},{3:f0}", pixRect.Left, pixRect.Top, pixRect.Right, pixRect.Bottom); }
/// <summary> /// Determines the shape type and Coords values for this GraphObj /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <param name="g"> /// The g. /// </param> /// <param name="scaleFactor"> /// The scale Factor. /// </param> /// <param name="shape"> /// The shape. /// </param> /// <param name="coords"> /// The coords. /// </param> public override void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords) { // transform the x,y location from the user-defined // coordinate frame to the screen pixel location PointF pix = this._location.Transform(pane); PointF[] pts = this._fontSpec.GetBox(g, this._text, pix.X, pix.Y, this._location.AlignH, this._location.AlignV, scaleFactor, new SizeF()); shape = "poly"; coords = string.Format( "{0:f0},{1:f0},{2:f0},{3:f0},{4:f0},{5:f0},{6:f0},{7:f0},", pts[0].X, pts[0].Y, pts[1].X, pts[1].Y, pts[2].X, pts[2].Y, pts[3].X, pts[3].Y); }
/// <summary> /// Determine if the specified screen point lies inside the bounding box of this /// <see cref="BoxObj"/>. /// </summary> /// <param name="pt"> /// The screen point, in pixels /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <returns> /// true if the point lies in the bounding box, false otherwise /// </returns> public override bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor) { if (!base.PointInBox(pt, pane, g, scaleFactor)) { return false; } // transform the x,y location from the user-defined // coordinate frame to the screen pixel location RectangleF pixRect = this._location.TransformRect(pane); return pixRect.Contains(pt); }
/// <summary> /// Determine if the specified screen point lies inside the bounding box of this /// <see cref="TextObj"/>. This method takes into account rotation and alignment parameters of the text, as specified in the <see cref="FontSpec"/>. /// </summary> /// <param name="pt"> /// The screen point, in pixels /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <returns> /// true if the point lies in the bounding box, false otherwise /// </returns> public override bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor) { if (!base.PointInBox(pt, pane, g, scaleFactor)) { return false; } // transform the x,y location from the user-defined // coordinate frame to the screen pixel location PointF pix = this._location.Transform(pane); return this._fontSpec.PointInBox( pt, g, this._text, pix.X, pix.Y, this._location.AlignH, this._location.AlignV, scaleFactor, this.LayoutArea); }
/// <summary> /// Determines the shape type and Coords values for this GraphObj /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <param name="g"> /// The g. /// </param> /// <param name="scaleFactor"> /// The scale Factor. /// </param> /// <param name="shape"> /// The shape. /// </param> /// <param name="coords"> /// The coords. /// </param> public abstract void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords);
/// <summary> /// Render this object to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { // Convert the arrow coordinates from the user coordinate system // to the screen coordinate system PointF pix1 = this.Location.TransformTopLeft(pane); PointF pix2 = this.Location.TransformBottomRight(pane); if (pix1.X > -10000 && pix1.X < 100000 && pix1.Y > -100000 && pix1.Y < 100000 && pix2.X > -10000 && pix2.X < 100000 && pix2.Y > -100000 && pix2.Y < 100000) { // calculate the length and the angle of the arrow "vector" double dy = pix2.Y - pix1.Y; double dx = pix2.X - pix1.X; float angle = (float)Math.Atan2(dy, dx) * 180.0F / (float)Math.PI; float length = (float)Math.Sqrt(dx * dx + dy * dy); // Save the old transform matrix Matrix transform = g.Transform; // Move the coordinate system so it is located at the starting point // of this arrow g.TranslateTransform(pix1.X, pix1.Y); // Rotate the coordinate system according to the angle of this arrow // about the starting point g.RotateTransform(angle); // get a pen according to this arrow properties using (Pen pen = this._line.GetPen(pane, scaleFactor)) { // new Pen( _line._color, pane.ScaledPenWidth( _line._width, scaleFactor ) ) ) // pen.DashStyle = _style; g.DrawLine(pen, 0, 0, length, 0); } // Restore the transform matrix back to its original RequestState g.Transform = transform; } }
/* /// <summary> /// Create a new <see cref="Pen"/> object from the properties of this /// <see cref="Border"/> object. /// </summary> /// <param name="isPenWidthScaled"> /// Set to true to have the <see cref="Border"/> pen width scaled with the /// scaleFactor. /// </param> /// <param name="scaleFactor"> /// The scaling factor for the features of the graph based on the <see cref="PaneBase.BaseDimension"/>. This /// scaling factor is calculated by the <see cref="PaneBase.CalcScaleFactor"/> method. The scale factor /// represents a linear multiple to be applied to font sizes, symbol sizes, etc. /// </param> /// <returns>A <see cref="Pen"/> object with the proper color and pen width.</returns> public Pen MakePen( bool isPenWidthScaled, float scaleFactor ) { float scaledPenWidth = _width; if ( isPenWidthScaled ) scaledPenWidth = (float)(_width * scaleFactor); return new Pen( _color, scaledPenWidth ); } */ /// <summary> /// Draw the specified Border (<see cref="RectangleF"/>) using the properties of this <see cref="Border"/> object. /// </summary> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor for the features of the graph based on the <see cref="PaneBase.BaseDimension"/>. This scaling factor is calculated by the /// <see cref="PaneBase.CalcScaleFactor"/> method. The scale factor represents a linear multiple to be applied to font sizes, symbol sizes, etc. /// </param> /// <param name="rect"> /// A <see cref="RectangleF"/> struct to be drawn. /// </param> public void Draw(Graphics g, PaneBase pane, float scaleFactor, RectangleF rect) { // Need to use the RectangleF props since rounding it can cause the axisFrame to // not line up properly with the last tic mark if (this._isVisible) { RectangleF tRect = rect; float scaledInflate = this._inflateFactor * scaleFactor; tRect.Inflate(scaledInflate, scaledInflate); using (Pen pen = this.GetPen(pane, scaleFactor)) g.DrawRectangle(pen, tRect.X, tRect.Y, tRect.Width, tRect.Height); } }
/// <summary> /// Determines the shape type and Coords values for this GraphObj /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <param name="g"> /// The g. /// </param> /// <param name="scaleFactor"> /// The scale Factor. /// </param> /// <param name="shape"> /// The shape. /// </param> /// <param name="coords"> /// The coords. /// </param> public override void GetCoords(PaneBase pane, Graphics g, float scaleFactor, out string shape, out string coords) { // transform the x,y location from the user-defined // coordinate frame to the screen pixel location RectangleF pixRect = this._location.TransformRect(pane); Matrix matrix = new Matrix(); if (pixRect.Right == 0) { pixRect.Width = 1; } float angle = (float)Math.Atan((pixRect.Top - pixRect.Bottom) / (pixRect.Left - pixRect.Right)); matrix.Rotate(angle, MatrixOrder.Prepend); // Move the coordinate system to local coordinates // of this text object (that is, at the specified // x,y location) matrix.Translate(-pixRect.Left, -pixRect.Top, MatrixOrder.Prepend); PointF[] pts = new PointF[4]; pts[0] = new PointF(0, 3); pts[1] = new PointF(pixRect.Width, 3); pts[2] = new PointF(pixRect.Width, -3); pts[3] = new PointF(0, -3); matrix.TransformPoints(pts); shape = "poly"; coords = string.Format( "{0:f0},{1:f0},{2:f0},{3:f0},{4:f0},{5:f0},{6:f0},{7:f0},", pts[0].X, pts[0].Y, pts[1].X, pts[1].Y, pts[2].X, pts[2].Y, pts[3].X, pts[3].Y); }
/// <summary> /// Render the <see cref="Legend"/> to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphPane"/> object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public void Draw(Graphics g, PaneBase pane, float scaleFactor) { // if the legend is not visible, do nothing if (!this._isVisible) { return; } // Fill the background with the specified color if required this._fill.Draw(g, this._rect); PaneList paneList = this.GetPaneList(pane); float halfGap = this._tmpSize / 2.0F; // Check for bad data values if (this._hStack <= 0) { this._hStack = 1; } if (this._legendItemWidth <= 0) { this._legendItemWidth = 100; } if (this._legendItemHeight <= 0) { this._legendItemHeight = this._tmpSize; } // float gap = pane.ScaledGap( scaleFactor ); int iEntry = 0; float x, y; // Get a brush for the legend label text using (SolidBrush brushB = new SolidBrush(Color.Black)) { foreach (GraphPane tmpPane in paneList) { // Loop for each curve in the CurveList collection // foreach ( CurveItem curve in tmpPane.CurveList ) int count = tmpPane.CurveList.Count; for (int i = 0; i < count; i++) { CurveItem curve = tmpPane.CurveList[this._isReverse ? count - i - 1 : i]; if (curve._label._text != string.Empty && curve._label._isVisible) { // Calculate the x,y (TopLeft) location of the current // curve legend label // assuming: // charHeight/2 for the left margin, plus legendWidth for each // horizontal column // legendHeight is the line spacing, with no extra margin above x = this._rect.Left + halfGap / 2.0F + (iEntry % this._hStack) * this._legendItemWidth; y = this._rect.Top + iEntry / this._hStack * this._legendItemHeight; // Draw the legend label for the current curve FontSpec tmpFont = (curve._label._fontSpec != null) ? curve._label._fontSpec : this.FontSpec; // This is required because, for long labels, the centering can affect the // position in GDI+. tmpFont.StringAlignment = StringAlignment.Near; if (this._isShowLegendSymbols) { tmpFont.Draw( g, pane, curve._label._text, x + 2.5F * this._tmpSize, y + this._legendItemHeight / 2.0F, AlignH.Left, AlignV.Center, scaleFactor); RectangleF rect = new RectangleF( x, y + this._legendItemHeight / 4.0F, 2 * this._tmpSize, this._legendItemHeight / 2.0F); curve.DrawLegendKey(g, tmpPane, rect, scaleFactor); } else { if (curve._label._fontSpec == null) { tmpFont.FontColor = curve.Color; } tmpFont.Draw( g, pane, curve._label._text, x + 0.0F * this._tmpSize, y + this._legendItemHeight / 2.0F, AlignH.Left, AlignV.Center, scaleFactor); } // maintain a curve count for positioning iEntry++; } } if (pane is MasterPane && ((MasterPane)pane).IsUniformLegendEntries) { break; } } // Draw a border around the legend if required if (iEntry > 0) { this.Border.Draw(g, pane, scaleFactor, this._rect); } } }
/// <summary> /// Determine if the specified screen point lies inside the bounding box of this /// <see cref="LineObj"/>. /// </summary> /// <remarks> /// The bounding box is calculated assuming a distance of <see cref="GraphPane.Default.NearestTol"/> pixels around the arrow segment. /// </remarks> /// <param name="pt"> /// The screen point, in pixels /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> /// <returns> /// true if the point lies in the bounding box, false otherwise /// </returns> public override bool PointInBox(PointF pt, PaneBase pane, Graphics g, float scaleFactor) { if (!base.PointInBox(pt, pane, g, scaleFactor)) { return false; } // transform the x,y location from the user-defined // coordinate frame to the screen pixel location PointF pix = this._location.TransformTopLeft(pane); PointF pix2 = this._location.TransformBottomRight(pane); using (Pen pen = new Pen(Color.Black, (float)GraphPane.Default.NearestTol * 2.0F)) { using (GraphicsPath path = new GraphicsPath()) { path.AddLine(pix, pix2); return path.IsOutlineVisible(pt, pen); } } }
/// <summary> /// The get pane list. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <returns> /// The <see cref="PaneList"/>. /// </returns> private PaneList GetPaneList(PaneBase pane) { // For a single GraphPane, create a PaneList to contain it // Otherwise, just use the paneList from the MasterPane PaneList paneList; if (pane is GraphPane) { paneList = new PaneList(); paneList.Add((GraphPane)pane); } else { paneList = ((MasterPane)pane).PaneList; } return paneList; }
/// <summary> /// Render this object to the specified <see cref="Graphics"/> device This method is normally only called by the Draw method of the parent /// <see cref="GraphObjList"/> collection object. /// </summary> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { if (this._image != null) { // Convert the rectangle coordinates from the user coordinate system // to the screen coordinate system RectangleF tmpRect = this._location.TransformRect(pane); if (this._isScaled) { g.DrawImage(this._image, tmpRect); } else { Region clip = g.Clip; g.SetClip(tmpRect); g.DrawImageUnscaled(this._image, Rectangle.Round(tmpRect)); g.SetClip(clip, CombineMode.Replace); // g.DrawImageUnscaledAndClipped( image, Rectangle.Round( tmpRect ) ); } } }
/// <summary> /// Render this object to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { if (this._points != null && this._points.Length > 1) { using (GraphicsPath path = this.MakePath(pane)) { // Fill or draw the symbol as required if (this._fill.IsVisible) { using (Brush brush = this.Fill.MakeBrush(path.GetBounds())) g.FillPath(brush, path); } if (this._border.IsVisible) { using (Pen pen = this._border.GetPen(pane, scaleFactor)) g.DrawPath(pen, path); } } } }
/// <summary> /// Render this object to the specified <see cref="Graphics"/> device. /// </summary> /// <remarks> /// This method is normally only called by the Draw method of the parent <see cref="GraphObjList"/> collection object. /// </remarks> /// <param name="g"> /// A graphic device object to be drawn into. This is normally e.Graphics from the PaintEventArgs argument to the Paint() method. /// </param> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that is the parent or owner of this object. /// </param> /// <param name="scaleFactor"> /// The scaling factor to be used for rendering objects. This is calculated and passed down by the parent <see cref="GraphPane"/> object using the /// <see cref="PaneBase.CalcScaleFactor"/> method, and is used to proportionally adjust font sizes, etc. according to the actual size of the graph. /// </param> public override void Draw(Graphics g, PaneBase pane, float scaleFactor) { // Convert the arrow coordinates from the user coordinate system // to the screen coordinate system RectangleF pixRect = this.Location.TransformRect(pane); // Clip the rect to just outside the PaneRect so we don't end up with wild coordinates. RectangleF tmpRect = pane.Rect; tmpRect.Inflate(20, 20); pixRect.Intersect(tmpRect); if (Math.Abs(pixRect.Left) < 100000 && Math.Abs(pixRect.Top) < 100000 && Math.Abs(pixRect.Right) < 100000 && Math.Abs(pixRect.Bottom) < 100000) { // If the box is to be filled, fill it this._fill.Draw(g, pixRect); // Draw the border around the box if required this._border.Draw(g, pane, scaleFactor, pixRect); } }
/// <summary> /// The make path. /// </summary> /// <param name="pane"> /// The pane. /// </param> /// <returns> /// The <see cref="GraphicsPath"/>. /// </returns> internal GraphicsPath MakePath(PaneBase pane) { GraphicsPath path = new GraphicsPath(); bool first = true; PointF lastPt = new PointF(); foreach (PointD pt in this._points) { // Convert the coordinates from the user coordinate system // to the screen coordinate system // Offset the points by the location value PointF pixPt = Location.Transform(pane, pt.X + this._location.X, pt.Y + this._location.Y, this._location.CoordinateFrame); if (Math.Abs(pixPt.X) < 100000 && Math.Abs(pixPt.Y) < 100000) { if (first) { first = false; } else { path.AddLine(lastPt, pixPt); } lastPt = pixPt; } } if (this._isClosedFigure) { path.CloseFigure(); } return path; }
/// <summary> /// Transform a data point from the specified coordinate type (<see cref="CoordType"/>) to display device coordinates (pixels). /// </summary> /// <remarks> /// If <see paramref="pane"/> is not of type <see cref="GraphPane"/>, then only the <see cref="CoordType.PaneFraction"/> transformation is /// available. /// </remarks> /// <param name="pane"> /// A reference to the <see cref="PaneBase"/> object that contains the <see cref="Axis"/> classes which will be used for the /// transform. /// </param> /// <param name="x"> /// The x coordinate that defines the point in user space. /// </param> /// <param name="y"> /// The y coordinate that defines the point in user space. /// </param> /// <param name="coord"> /// A <see cref="CoordType"/> type that defines the coordinate system in which the X,Y pair is defined. /// </param> /// <returns> /// A point in display device coordinates that corresponds to the specified user point. /// </returns> public static PointF Transform(PaneBase pane, double x, double y, CoordType coord) { return pane.TransformCoord(x, y, coord); }