当前位置: 首页>>代码示例>>C#>>正文


C# IRenderContext.DrawRectangle方法代码示例

本文整理汇总了C#中IRenderContext.DrawRectangle方法的典型用法代码示例。如果您正苦于以下问题:C# IRenderContext.DrawRectangle方法的具体用法?C# IRenderContext.DrawRectangle怎么用?C# IRenderContext.DrawRectangle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IRenderContext的用法示例。


在下文中一共展示了IRenderContext.DrawRectangle方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Render

        /// <summary>
        /// Renders the axis on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="model">The model.</param>
        /// <param name="axisLayer">The rendering order.</param>
        /// <param name="pass">The render pass.</param>
        public override void Render(IRenderContext rc, PlotModel model, AxisLayer axisLayer, int pass)
        {
            if (this.Position == AxisPosition.None)
            {
                return;
            }

            if (pass == 0)
            {
                double left = model.PlotArea.Left;
                double top = model.PlotArea.Top;
                double width = this.MajorTickSize - 2;
                double height = this.MajorTickSize - 2;

                switch (this.Position)
                {
                    case AxisPosition.Left:
                        left = model.PlotArea.Left - this.PositionTierMinShift - width;
                        top = model.PlotArea.Top;
                        break;
                    case AxisPosition.Right:
                        left = model.PlotArea.Right + this.PositionTierMinShift;
                        top = model.PlotArea.Top;
                        break;
                    case AxisPosition.Top:
                        left = model.PlotArea.Left;
                        top = model.PlotArea.Top - this.PositionTierMinShift - height;
                        break;
                    case AxisPosition.Bottom:
                        left = model.PlotArea.Left;
                        top = model.PlotArea.Bottom + this.PositionTierMinShift;
                        break;
                }

                Action<double, double, OxyColor> drawColorRect = (ylow, yhigh, color) =>
                    {
                        double ymin = Math.Min(ylow, yhigh);
                        double ymax = Math.Max(ylow, yhigh);
                        rc.DrawRectangle(
                            this.IsHorizontal()
                                ? new OxyRect(ymin, top, ymax - ymin, height)
                                : new OxyRect(left, ymin, width, ymax - ymin),
                            color,
                            null);
                    };

                int n = this.Palette.Colors.Count;
                for (int i = 0; i < n; i++)
                {
                    double ylow = this.Transform(this.GetLowValue(i));
                    double yhigh = this.Transform(this.GetHighValue(i));
                    drawColorRect(ylow, yhigh, this.Palette.Colors[i]);
                }

                double highLowLength = 10;
                if (this.IsHorizontal())
                {
                    highLowLength *= -1;
                }

                if (this.LowColor != null)
                {
                    double ylow = this.Transform(this.ActualMinimum);
                    drawColorRect(ylow, ylow + highLowLength, this.LowColor);
                }

                if (this.HighColor != null)
                {
                    double yhigh = this.Transform(this.ActualMaximum);
                    drawColorRect(yhigh, yhigh - highLowLength, this.HighColor);
                }
            }

            base.Render(rc, model, axisLayer, pass);
        }
开发者ID:jgodinez,项目名称:OxyPlot.2DGraphLib.MonoTouch,代码行数:82,代码来源:ColorAxis.cs

示例2: RenderFromXml

        public static bool RenderFromXml(Stream xmlStream, IRenderContext renderContext, out Size imageSize)
        {
            XmlDocument doc = new XmlDocument();
            doc.Load(xmlStream);

            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(doc.NameTable);
            namespaceManager.AddNamespace("p", PreviewNamespace);

            XmlNode previewNode = doc.SelectSingleNode("/p:preview", namespaceManager);
            imageSize = new Size(double.Parse(previewNode.Attributes["width"].InnerText), double.Parse(previewNode.Attributes["height"].InnerText));

            XmlNodeList renderNodes = previewNode.ChildNodes;
            foreach (XmlNode renderNode in renderNodes)
            {
                XmlElement renderElement = renderNode as XmlElement;

                if (renderElement == null)
                    continue;

                if (renderElement.Name == "line")
                {
                    Point start = Point.Parse(renderElement.Attributes["start"].InnerText);
                    Point end = Point.Parse(renderElement.Attributes["end"].InnerText);
                    double thickness = double.Parse(renderElement.Attributes["thickness"].InnerText);
                    renderContext.DrawLine(start, end, thickness);
                }
                else if (renderElement.Name == "rect")
                {
                    Point start = Point.Parse(renderElement.Attributes["start"].InnerText);
                    Size size = Size.Parse(renderElement.Attributes["size"].InnerText);
                    double thickness = double.Parse(renderElement.Attributes["thickness"].InnerText);
                    bool fill = bool.Parse(renderElement.Attributes["fill"].InnerText);
                    renderContext.DrawRectangle(start, size, thickness, fill);
                }
                else if (renderElement.Name == "ellipse")
                {
                    Point centre = Point.Parse(renderElement.Attributes["centre"].InnerText);
                    double radiusx = double.Parse(renderElement.Attributes["rx"].InnerText);
                    double radiusy = double.Parse(renderElement.Attributes["ry"].InnerText);
                    double thickness = double.Parse(renderElement.Attributes["thickness"].InnerText);
                    bool fill = bool.Parse(renderElement.Attributes["fill"].InnerText);
                    renderContext.DrawEllipse(centre, radiusx, radiusy, thickness, fill);
                }
                else if (renderElement.Name == "path")
                {
                    Point start = Point.Parse(renderElement.Attributes["start"].InnerText);
                    double thickness = double.Parse(renderElement.Attributes["thickness"].InnerText);
                    bool fill = bool.Parse(renderElement.Attributes["fill"].InnerText);
                    string data = renderElement.InnerText;
                    List<IPathCommand> pathCommands = new List<IPathCommand>();
                    using (MemoryStream dataStream = new MemoryStream(Convert.FromBase64String(data)))
                    {
                        BinaryReader reader = new BinaryReader(dataStream);

                        int numCommands = reader.ReadInt32();

                        for (int l = 0; l < numCommands; l++)
                        {
                            CommandType pType = (CommandType)reader.ReadInt32();
                            IPathCommand theCommand = null;
                            switch (pType)
                            {
                                case CommandType.MoveTo:
                                    theCommand = new MoveTo();
                                    break;
                                case CommandType.LineTo:
                                    theCommand = new LineTo();
                                    break;
                                case CommandType.CurveTo:
                                    theCommand = new CurveTo();
                                    break;
                                case CommandType.EllipticalArcTo:
                                    theCommand = new EllipticalArcTo();
                                    break;
                                case CommandType.QuadraticBeizerCurveTo:
                                    theCommand = new QuadraticBeizerCurveTo();
                                    break;
                                case CommandType.SmoothCurveTo:
                                    theCommand = new SmoothCurveTo();
                                    break;
                                case CommandType.SmoothQuadraticBeizerCurveTo:
                                    theCommand = new SmoothQuadraticBeizerCurveTo();
                                    break;
                                default:
                                    theCommand = new ClosePath();
                                    break;
                            }
                            theCommand.Read(reader);
                            pathCommands.Add(theCommand);
                        }
                    }
                    renderContext.DrawPath(start, pathCommands, thickness, fill);
                }
                else if (renderElement.Name == "text")
                {
                    Point anchor = Point.Parse(renderElement.Attributes["anchor"].InnerText);
                    TextAlignment alignment = (TextAlignment)Enum.Parse(typeof(TextAlignment), renderElement.Attributes["alignment"].InnerText);
                    List<TextRun> runs = new List<TextRun>();
                    foreach (XmlNode runNode in renderElement.ChildNodes)
                    {
//.........这里部分代码省略.........
开发者ID:csuffyy,项目名称:circuitdiagram,代码行数:101,代码来源:XmlRenderer.cs

示例3: Render

        /// <summary>
        /// Renders the annotation on the specified context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        public override void Render(IRenderContext rc)
        {
            base.Render(rc);

            var lon0 = this.XAxis.ActualMinimum;
            var lon1 = this.XAxis.ActualMaximum;
            var lat0 = this.YAxis.ActualMinimum;
            var lat1 = this.YAxis.ActualMaximum;

            // the desired number of tiles horizontally
            double tilesx = this.PlotModel.Width / this.TileSize;

            // calculate the desired zoom level
            var n = tilesx / (((lon1 + 180) / 360) - ((lon0 + 180) / 360));
            var zoom = (int)Math.Round(Math.Log(n) / Math.Log(2));
            if (zoom < this.MinZoomLevel)
            {
                zoom = this.MinZoomLevel;
            }

            if (zoom > this.MaxZoomLevel)
            {
                zoom = this.MaxZoomLevel;
            }

            // find tile coordinates for the corners
            double x0, y0;
            LatLonToTile(lat0, lon0, zoom, out x0, out y0);
            double x1, y1;
            LatLonToTile(lat1, lon1, zoom, out x1, out y1);

            double xmax = Math.Max(x0, x1);
            double xmin = Math.Min(x0, x1);
            double ymax = Math.Max(y0, y1);
            double ymin = Math.Min(y0, y1);

            var clippingRectangle = this.GetClippingRect();

            // Add the tiles
            for (var x = (int)xmin; x < xmax; x++)
            {
                for (var y = (int)ymin; y < ymax; y++)
                {
                    string uri = this.GetTileUri(x, y, zoom);
                    var img = this.GetImage(uri, rc.RendersToScreen);

                    if (img == null)
                    {
                        continue;
                    }

                    // transform from tile coordinates to lat/lon
                    double latitude0, latitude1, longitude0, longitude1;
                    TileToLatLon(x, y, zoom, out latitude0, out longitude0);
                    TileToLatLon(x + 1, y + 1, zoom, out latitude1, out longitude1);

                    // transform from lat/lon to screen coordinates
                    var s00 = this.Transform(longitude0, latitude0);
                    var s11 = this.Transform(longitude1, latitude1);

                    var r = OxyRect.Create(s00.X, s00.Y, s11.X, s11.Y);

                    // draw the image
                    rc.DrawClippedImage(clippingRectangle, img, r.Left, r.Top, r.Width, r.Height, this.Opacity, true);
                }
            }

            // draw the copyright notice
            var p = new ScreenPoint(clippingRectangle.Right - 5, clippingRectangle.Bottom - 5);
            var textSize = rc.MeasureText(this.CopyrightNotice, this.ActualFont, this.ActualFontSize, this.ActualFontWeight);
            rc.DrawRectangle(new OxyRect(p.X - textSize.Width - 2, p.Y - textSize.Height - 2, textSize.Width + 4, textSize.Height + 4), OxyColor.FromAColor(200, OxyColors.White), OxyColors.Undefined);

            rc.DrawText(
                p,
                this.CopyrightNotice,
                OxyColors.Black,
                this.ActualFont,
                this.ActualFontSize,
                this.ActualFontWeight,
                0,
                HorizontalAlignment.Right,
                VerticalAlignment.Bottom);
        }
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:87,代码来源:TileMapAnnotation.cs

示例4: Render

        /// <summary>
        /// Renders the icon on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="size">The size.</param>
        public override void Render(IRenderContext rc, double size)
        {
            var n = (int)size * 2;
            var data = ArrayHelper.Evaluate(Functions.Peaks, ArrayHelper.CreateVector(-3.1, 2.6, n), ArrayHelper.CreateVector(3.0, -3.4, n));
            var palette = OxyPalettes.BlueWhiteRed(5);
            var min = data.Min2D();
            var max = data.Max2D();
            var pixels = new OxyColor[n, n];
            for (int x = 0; x < n; x++)
            {
                for (int y = 0; y < n; y++)
                {
                    var i = (int)((data[x, y] - min) / (max - min) * palette.Colors.Count);
                    i = Math.Min(Math.Max(i, 0), palette.Colors.Count - 1);
                    pixels[y, n - 1 - x] = palette.Colors[i];
                }
            }

            var image = OxyImage.Create(pixels, OxyPlot.ImageFormat.Png);
            rc.DrawImage(image, 0, 0, n, n, 0, 0, size, size, 1, true);

            var frameWidth = (int)Math.Max(Math.Round(size / 32), 1);
            rc.DrawRectangle(new OxyRect(0, 0, size, frameWidth), OxyColors.Black, OxyColors.Black, 0);
            rc.DrawRectangle(new OxyRect(0, size - frameWidth, size, frameWidth), OxyColors.Black, OxyColors.Undefined, 0);
            rc.DrawRectangle(new OxyRect(0, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0);
            rc.DrawRectangle(new OxyRect(size - frameWidth, 0, frameWidth, size), OxyColors.Black, OxyColors.Undefined, 0);
        }
开发者ID:kleopatra999,项目名称:icon-generator,代码行数:32,代码来源:Program.cs

示例5: Render

        /// <summary>
        /// Renders the axis on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="pass">The render pass.</param>
        public override void Render(IRenderContext rc, int pass)
        {
            if (this.Position == AxisPosition.None)
            {
                return;
            }

            if (this.Palette == null)
            {
                throw new InvalidOperationException("No Palette defined for color axis.");
            }

            if (pass == 0)
            {
                double distance = this.AxisDistance;
                double left = this.PlotModel.PlotArea.Left;
                double top = this.PlotModel.PlotArea.Top;
                double width = this.MajorTickSize - 2;
                double height = this.MajorTickSize - 2;

                switch (this.Position)
                {
                    case AxisPosition.Left:
                        left = this.PlotModel.PlotArea.Left - this.PositionTierMinShift - width - distance;
                        top = this.PlotModel.PlotArea.Top;
                        break;
                    case AxisPosition.Right:
                        left = this.PlotModel.PlotArea.Right + this.PositionTierMinShift + distance;
                        top = this.PlotModel.PlotArea.Top;
                        break;
                    case AxisPosition.Top:
                        left = this.PlotModel.PlotArea.Left;
                        top = this.PlotModel.PlotArea.Top - this.PositionTierMinShift - height - distance;
                        break;
                    case AxisPosition.Bottom:
                        left = this.PlotModel.PlotArea.Left;
                        top = this.PlotModel.PlotArea.Bottom + this.PositionTierMinShift + distance;
                        break;
                }

                if (this.RenderAsImage)
                {
                    var axisLength = this.Transform(this.ActualMaximum) - this.Transform(this.ActualMinimum);
                    bool reverse = axisLength > 0;
                    axisLength = Math.Abs(axisLength);

                    if (this.IsHorizontal())
                    {
                        var colorAxisImage = this.GenerateColorAxisImage(reverse);
                        rc.DrawImage(colorAxisImage, left, top, axisLength, height, 1, true);
                    }
                    else
                    {
                        var colorAxisImage = this.GenerateColorAxisImage(reverse);
                        rc.DrawImage(colorAxisImage, left, top, width, axisLength, 1, true);
                    }
                }
                else
                {
                    Action<double, double, OxyColor> drawColorRect = (ylow, yhigh, color) =>
                                       {
                                           double ymin = Math.Min(ylow, yhigh);
                                           double ymax = Math.Max(ylow, yhigh) + 0.5;
                                           rc.DrawRectangle(
                                               this.IsHorizontal()
                                                   ? new OxyRect(ymin, top, ymax - ymin, height)
                                                   : new OxyRect(left, ymin, width, ymax - ymin),
                                               color,
                                               OxyColors.Undefined);
                                       };

                    int n = this.Palette.Colors.Count;
                    for (int i = 0; i < n; i++)
                    {
                        double ylow = this.Transform(this.GetLowValue(i));
                        double yhigh = this.Transform(this.GetHighValue(i));
                        drawColorRect(ylow, yhigh, this.Palette.Colors[i]);
                    }

                    double highLowLength = 10;
                    if (this.IsHorizontal())
                    {
                        highLowLength *= -1;
                    }

                    if (!this.LowColor.IsUndefined())
                    {
                        double ylow = this.Transform(this.ActualMinimum);
                        drawColorRect(ylow, ylow + highLowLength, this.LowColor);
                    }

                    if (!this.HighColor.IsUndefined())
                    {
                        double yhigh = this.Transform(this.ActualMaximum);
                        drawColorRect(yhigh, yhigh - highLowLength, this.HighColor);
//.........这里部分代码省略.........
开发者ID:Keyabob,项目名称:MMG,代码行数:101,代码来源:LinearColorAxis.cs

示例6: RenderBackgrounds

        /// <summary>
        /// Renders the series backgrounds.
        /// </summary>
        /// <param name="rc">The render context.</param>
        private void RenderBackgrounds(IRenderContext rc)
        {
            // Render the main background of the plot area (only if there are axes)
            // The border is rendered by DrawRectangleAsPolygon to ensure that it is pixel aligned with the tick marks.
            if (this.Axes.Count > 0 && this.PlotAreaBackground.IsVisible())
            {
                rc.DrawRectangleAsPolygon(this.PlotArea, this.PlotAreaBackground, OxyColors.Undefined, 0);
            }

            foreach (var s in this.Series.Where(s => s.IsVisible && s is XYAxisSeries && s.Background.IsVisible()).Cast<XYAxisSeries>())
            {
                rc.DrawRectangle(s.GetScreenRectangle(), s.Background, OxyColors.Undefined, 0);
            }
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:18,代码来源:PlotModel.Rendering.cs

示例7: RenderBackgrounds

        /// <summary>
        /// Renders the series backgrounds.
        /// </summary>
        /// <param name="rc">
        /// The render context.
        /// </param>
        private void RenderBackgrounds(IRenderContext rc)
        {
            // Render the main background of the plot area (only if there are axes)
            // The border is rendered by DrawRectangleAsPolygon to ensure that it is pixel aligned with the tick marks.
            if (this.Axes.Count > 0 && this.PlotAreaBackground != null)
            {
                rc.DrawRectangleAsPolygon(this.PlotArea, this.PlotAreaBackground, null, 0);
            }

            foreach (var s in this.VisibleSeries)
            {
                var s2 = s as XYAxisSeries;
                if (s2 == null || s2.Background == null)
                {
                    continue;
                }

                rc.DrawRectangle(s2.GetScreenRectangle(), s2.Background, null, 0);
            }
        }
开发者ID:aleksanderkobylak,项目名称:oxyplot,代码行数:26,代码来源:PlotModel.Rendering.cs

示例8: Render

        /// <summary>
        /// Renders the axis on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="pass">The render pass.</param>
        public override void Render(IRenderContext rc, int pass)
        {
            if (this.Position == AxisPosition.None)
            {
                return;
            }

            if (pass == 0)
            {
                double distance = this.AxisDistance;
                double left = this.PlotModel.PlotArea.Left;
                double top = this.PlotModel.PlotArea.Top;
                double width = this.MajorTickSize - 2;
                double height = this.MajorTickSize - 2;

                const int TierShift = 0;

                switch (this.Position)
                {
                    case AxisPosition.Left:
                        left = this.PlotModel.PlotArea.Left - TierShift - width - distance;
                        top = this.PlotModel.PlotArea.Top;
                        break;
                    case AxisPosition.Right:
                        left = this.PlotModel.PlotArea.Right + TierShift + distance;
                        top = this.PlotModel.PlotArea.Top;
                        break;
                    case AxisPosition.Top:
                        left = this.PlotModel.PlotArea.Left;
                        top = this.PlotModel.PlotArea.Top - TierShift - height - distance;
                        break;
                    case AxisPosition.Bottom:
                        left = this.PlotModel.PlotArea.Left;
                        top = this.PlotModel.PlotArea.Bottom + TierShift + distance;
                        break;
                }

                Action<double, double, OxyColor> drawColorRect = (ylow, yhigh, color) =>
                {
                    double ymin = Math.Min(ylow, yhigh);
                    double ymax = Math.Max(ylow, yhigh);
                    rc.DrawRectangle(
                        this.IsHorizontal()
                            ? new OxyRect(ymin, top, ymax - ymin, height)
                            : new OxyRect(left, ymin, width, ymax - ymin),
                        color,
                        OxyColors.Undefined);
                };

                foreach (ColorRange range in this.ranges)
                {
                    double ylow = this.Transform(range.LowerBound);
                    double yhigh = this.Transform(range.UpperBound);

                    double ymax = this.Transform(this.ActualMaximum);
                    double ymin = this.Transform(this.ActualMinimum);

                    if (this.IsHorizontal())
                    {
                        if (ylow < ymin)
                        {
                            ylow = ymin;
                        }

                        if (yhigh > ymax)
                        {
                            yhigh = ymax;
                        }
                    }
                    else
                    {
                        if (ylow > ymin)
                        {
                            ylow = ymin;
                        }

                        if (yhigh < ymax)
                        {
                            yhigh = ymax;
                        }
                    }

                    drawColorRect(ylow, yhigh, range.Color);
                }

                double highLowLength = 10;
                if (this.IsHorizontal())
                {
                    highLowLength *= -1;
                }

                if (!this.LowColor.IsUndefined())
                {
                    double ylow = this.Transform(this.ActualMinimum);
                    drawColorRect(ylow, ylow + highLowLength, this.LowColor);
//.........这里部分代码省略.........
开发者ID:huoxudong125,项目名称:oxyplot,代码行数:101,代码来源:RangeColorAxis.cs

示例9: Render

        /// <summary>
        /// Renders the text annotation.
        /// </summary>
        /// <param name="rc">The render context.</param>
        public override void Render(IRenderContext rc)
        {
            base.Render(rc);

            var position = this.Transform(this.TextPosition) + this.Offset;

            var clippingRectangle = this.GetClippingRect();

            var textSize = rc.MeasureText(this.Text, this.ActualFont, this.ActualFontSize, this.ActualFontWeight);

            rc.SetClip(clippingRectangle);
            this.actualBounds = GetTextBounds(
                position, textSize, this.Padding, this.TextRotation, this.TextHorizontalAlignment, this.TextVerticalAlignment);

            if ((this.TextRotation % 90).Equals(0))
            {
                var actualRect = new OxyRect(this.actualBounds[0], this.actualBounds[2]);
                rc.DrawRectangle(actualRect, this.Background, this.Stroke, this.StrokeThickness);
            }
            else
            {
                rc.DrawPolygon(this.actualBounds, this.Background, this.Stroke, this.StrokeThickness);
            }

            rc.DrawMathText(
                position,
                this.Text,
                this.GetSelectableFillColor(this.ActualTextColor),
                this.ActualFont,
                this.ActualFontSize,
                this.ActualFontWeight,
                this.TextRotation,
                this.TextHorizontalAlignment,
                this.TextVerticalAlignment);

            rc.ResetClip();
        }
开发者ID:Keyabob,项目名称:MMG,代码行数:41,代码来源:TextAnnotation.cs

示例10: Render

        /// <summary>
        /// Renders the axis on the specified render context.
        /// </summary>
        /// <param name="rc">The render context.</param>
        /// <param name="model">The model.</param>
        /// <param name="axisLayer">The layer.</param>
        /// <param name="pass">The pass.</param>
        public override void Render(IRenderContext rc, PlotModel model, AxisLayer axisLayer, int pass)
        {
            if (this.Position == AxisPosition.None)
            {
                return;
            }

            if (pass == 0)
            {
                double left = model.PlotArea.Left;
                double top = model.PlotArea.Top;
                double width = this.MajorTickSize - 2;
                double height = this.MajorTickSize - 2;

                switch (this.Position)
                {
                    case AxisPosition.Left:
                        left = model.PlotArea.Left - this.PositionTierMinShift - width;
                        top = model.PlotArea.Top;
                        break;
                    case AxisPosition.Right:
                        left = model.PlotArea.Right + this.PositionTierMinShift;
                        top = model.PlotArea.Top;
                        break;
                    case AxisPosition.Top:
                        left = model.PlotArea.Left;
                        top = model.PlotArea.Top - this.PositionTierMinShift - height;
                        break;
                    case AxisPosition.Bottom:
                        left = model.PlotArea.Left;
                        top = model.PlotArea.Bottom + this.PositionTierMinShift;
                        break;
                }

                Action<double, double, OxyColor> drawColorRect = (ylow, yhigh, color) =>
                {
                    double ymin = Math.Min(ylow, yhigh);
                    double ymax = Math.Max(ylow, yhigh);
                    rc.DrawRectangle(
                        this.IsHorizontal()
                            ? new OxyRect(ymin, top, ymax - ymin, height)
                            : new OxyRect(left, ymin, width, ymax - ymin),
                        color,
                        OxyColors.Undefined);
                };

                IList<double> majorLabelValues;
                IList<double> majorTickValues;
                IList<double> minorTickValues;
                this.GetTickValues(out majorLabelValues, out majorTickValues, out minorTickValues);

                int n = this.Palette.Colors.Count;
                for (int i = 0; i < n; i++)
                {
                    double low = this.Transform(this.GetLowValue(i, majorLabelValues));
                    double high = this.Transform(this.GetHighValue(i, majorLabelValues));
                    drawColorRect(low, high, this.Palette.Colors[i]);
                }
            }

            base.Render(rc, model, axisLayer, pass);
        }
开发者ID:Celderon,项目名称:oxyplot,代码行数:69,代码来源:CategoryColorAxis.cs


注:本文中的IRenderContext.DrawRectangle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。