public override void Draw(IGraphicsContext3D g, DrawContext dc, double xbase, double ybase, double zbase) { var mylayer = (HostLayer)dc.LinkedObject; var layer = mylayer as XYZPlotLayer; if (_layerNumber >= 0 && mylayer.SiblingLayers != null && _layerNumber < mylayer.SiblingLayers.Count) { layer = mylayer.SiblingLayers[_layerNumber] as XYZPlotLayer; } if (null == layer) { return; } if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = dc.FontCache.GetFontInfo(Style.FontId); IGPlotItem pa = layer.PlotItems.Flattened[_plotNumber]; var symbolpos = new PointD3D(xbase, (ybase + 0.5 * fontInfo.cyDescent - 0.5 * fontInfo.cyAscent), 0); var symbolRect = new RectangleD3D(symbolpos, new VectorD3D(SizeX, 0, 0)); symbolRect = symbolRect.WithPadding(0, fontInfo.Size, 0); pa.PaintSymbol(g, symbolRect); if (!dc.bForPreview) { var volume = new RectangleTransformedD3D( new RectangleD3D(symbolpos.X, symbolpos.Y - 0.5 * fontInfo.cyLineSpace, 0, SizeX, fontInfo.cyLineSpace, 0), dc.transformMatrix); dc._cachedSymbolPositions.Add(volume, pa); } } }
public override void Draw(Graphics g, DrawContext dc, double xbase, double ybase) { var mylayer = (HostLayer)dc.LinkedObject; var layer = mylayer as XYPlotLayer; if (_layerNumber >= 0 && mylayer.SiblingLayers != null && _layerNumber < mylayer.SiblingLayers.Count) layer = mylayer.SiblingLayers[_layerNumber] as XYPlotLayer; if (null == layer) return; if (_plotNumber < layer.PlotItems.Flattened.Length) { var fontInfo = dc.FontCache.GetFontInfo(g, Style.FontId); IGPlotItem pa = layer.PlotItems.Flattened[_plotNumber]; var symbolpos = new PointF((float)xbase, (float)(ybase + 0.5 * fontInfo.cyDescent - 0.5 * fontInfo.cyAscent)); var symbolRect = new RectangleF(symbolpos, new SizeF((float)Width, 0)); symbolRect.Inflate(0, (float)(fontInfo.Size)); pa.PaintSymbol(g, symbolRect); if (!dc.bForPreview) { var gp = new GraphicsPath(); gp.AddRectangle(new RectangleF(symbolpos.X, (float)(symbolpos.Y - 0.5 * fontInfo.cyLineSpace), (float)Width, (float)(fontInfo.cyLineSpace))); gp.Transform(dc.transformMatrix); dc._cachedSymbolPositions.Add(gp, pa); } } }