예제 #1
0
 public RectangleF PaintSymbol(Graphics g, RectangleF bounds)
 {
     bounds.Inflate(0, -bounds.Height / 4);
     if (null != _fillBrush)
     {
         _fillBrush.SetEnvironment(bounds, BrushX.GetEffectiveMaximumResolution(g, 1));
         g.FillRectangle(_fillBrush, bounds);
     }
     if (null != _framePen)
     {
         _framePen.SetEnvironment(bounds, BrushX.GetEffectiveMaximumResolution(g, 1));
         g.DrawRectangle(_framePen, bounds.X, bounds.Y, bounds.Width, bounds.Height);
     }
     return(bounds);
 }
예제 #2
0
파일: GridStyle.cs 프로젝트: olesar/Altaxo
        public void Paint(Graphics g, IPlotArea layer, int axisnumber)
        {
            if (!_showGrid)
            {
                return;
            }

            Scale       axis    = layer.Scales[axisnumber];
            TickSpacing ticking = layer.Scales[axisnumber].TickSpacing;

            var layerRect = new RectangleD2D(PointD2D.Empty, layer.Size);

            if (_showZeroOnly)
            {
                var    var = new Altaxo.Data.AltaxoVariant(0.0);
                double rel = axis.PhysicalVariantToNormal(var);
                _majorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
                if (rel >= 0 && rel <= 1)
                {
                    if (axisnumber == 0)
                    {
                        layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(rel, 0), new Logical3D(rel, 1));
                    }
                    else
                    {
                        layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, rel), new Logical3D(1, rel));
                    }

                    //layer.DrawIsoLine(g, MajorPen, axisnumber, rel, 0, 1);
                }
            }
            else
            {
                double[] ticks;

                if (_showMinor)
                {
                    _minorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
                    ticks = ticking.GetMinorTicksNormal(axis);
                    for (int i = 0; i < ticks.Length; ++i)
                    {
                        if (axisnumber == 0)
                        {
                            layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
                        }
                        else
                        {
                            layer.CoordinateSystem.DrawIsoline(g, MinorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));
                        }

                        //layer.DrawIsoLine(g, MinorPen, axisnumber, ticks[i], 0, 1);
                    }
                }

                MajorPen.SetEnvironment(layerRect, BrushX.GetEffectiveMaximumResolution(g, 1));
                ticks = ticking.GetMajorTicksNormal(axis);
                for (int i = 0; i < ticks.Length; ++i)
                {
                    if (axisnumber == 0)
                    {
                        layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(ticks[i], 0), new Logical3D(ticks[i], 1));
                    }
                    else
                    {
                        layer.CoordinateSystem.DrawIsoline(g, MajorPen, new Logical3D(0, ticks[i]), new Logical3D(1, ticks[i]));
                    }

                    //layer.DrawIsoLine(g, MajorPen, axisnumber, ticks[i], 0, 1);
                }
            }
        }