Esempio n. 1
0
        /// <summary>
        /// Draws the specified text string at the specified location with the specified Brush and Font objects.
        /// </summary>
        /// <param name="s">String to draw.</param>
        /// <param name="font">Font that defines the text format of the string.</param>
        /// <param name="brush">Brush that determines the color and texture of the drawn text.</param>
        /// <param name="rectangleF">System.Drawing.RectangleF structure that specifies the location of the drawn text.</param>
        /// <param name="format">System.Drawing.StringFormat that specifies formatting attributes, such as line spacing and alignment, that are applied to the drawn text.</param>
        public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF, StringFormat2 format)
        {
            if (format != null && rectangleF.Width > 0)
            {
                switch (format.Alignment)
                {
                case StringAlignment2.Center:
                    rectangleF.X += (rectangleF.Width - MeasureString(s, font, (int)rectangleF.Width, format).Width) * 0.5f;
                    break;

                case StringAlignment2.Far:
                    rectangleF.X += rectangleF.Width - MeasureString(s, font, (int)rectangleF.Width, format).Width;
                    break;
                }
            }
            textList.Add(new Text {
                X          = rectangleF.X,
                Y          = rectangleF.Y + (font.Height * 0.5f),
                FontFamily = font.Name,
                FontSize   = font.Size * 1.2f,
                FontWeight = font.Bold ? "bold" : "normal",
                Value      = s,
                Fill       = BrushColor(brush),
                Transform  = Transform
            });
        }
Esempio n. 2
0
        private void PaintIndicator(IGraphics g, int width, int height)
        {
            Brush2 indicatorBrush = new Brush2(IndicatorColor);
            Pen2   indicatorPen   = new Pen2(ForeColor);
            float  len            = GetDeltaIndicator(GetLength(width, height));

            if (IsHorizontal())
            {
                if (len >= 1)
                {
                    g.FillRectangle(indicatorBrush, GetMinIndicator(GetLength(width, height)), 0, len, height - 1);
                    g.DrawRectangle(indicatorPen, GetMinIndicator(GetLength(width, height)), 0, len, height - 1);
                }
                else
                {
                    g.DrawLine(indicatorPen, GetMinIndicator(GetLength(width, height)), 0, GetMinIndicator(GetLength(width, height)),
                               height - 1);
                }
            }
            else
            {
                if (len >= 1)
                {
                    g.FillRectangle(indicatorBrush, 0, GetMinIndicator(GetLength(width, height)), width - 1, len);
                    g.DrawRectangle(indicatorPen, 0, GetMinIndicator(GetLength(width, height)), width - 1, len);
                }
                else
                {
                    g.DrawLine(indicatorPen, 0, GetMinIndicator(GetLength(width, height)), width - 1,
                               GetMinIndicator(GetLength(width, height)));
                }
            }
        }
Esempio n. 3
0
        public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
        {
            int s2 = size / 2;

            Point2[] points = { new Point2(x - s2, y), new Point2(x, y - s2), new Point2(x + s2, y), new Point2(x, y + s2) };
            g.DrawPolygon(pen, points);
        }
Esempio n. 4
0
        public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
        {
            int s2 = size / 2;

            g.DrawLine(pen, x - s2, y - s2, x + s2, y + s2);
            g.DrawLine(pen, x + s2, y - s2, x - s2, y + s2);
        }
        public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
        {
            int s2 = size / 2;

            g.FillRectangle(brush, x - s2, y - s2, size, size);
            g.DrawRectangle(pen, x - s2, y - s2, size, size);
        }
Esempio n. 6
0
        public void DrawString(string s, Font2 font, Brush2 brush, float x, float y)
        {
            StringFormat2 format = new StringFormat2 {
                Alignment = StringAlignment2.Near, LineAlignment = StringAlignment2.Near
            };

            DrawString(s, font, brush, new Rectangle2(new Point2(x, y), MeasureString(s, font)), format);
        }
Esempio n. 7
0
        internal static void DoPaint(IGraphics g, DataGridView grid)
        {
            Pen2          p            = new Pen2(GraphUtils.ToColor2(grid.GridColor));
            float         x            = grid.Location.X;
            float         y            = grid.Location.Y;
            Brush2        text         = new Brush2(GraphUtils.ToColor2(grid.ColumnHeadersDefaultCellStyle.ForeColor));
            Font2         headerFont   = GraphUtils.ToFont2(grid.ColumnHeadersDefaultCellStyle.Font);
            StringFormat2 headerformat = new StringFormat2 {
                Alignment     = StringAlignment2.Near,
                LineAlignment = StringAlignment2.Center
            };

            for (int c = 0; c < grid.Columns.Count; c++)
            {
                Brush2 header = new Brush2(GraphUtils.ToColor2(grid.Columns[c].HeaderCell.Style.BackColor));
                if (header.Color.IsEmpty || header.Color == Color2.Transparent || header.Color == Color2.Black ||
                    header.Color.Name == "0")
                {
                    header.Color = GraphUtils.ToColor2(grid.ColumnHeadersDefaultCellStyle.BackColor);
                }
                g.FillRectangle(header, x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight);
                g.DrawRectangle(p, x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight);
                g.DrawString(grid.Columns[c].HeaderText, headerFont, text,
                             new Rectangle2(x, y, grid.Columns[c].Width, grid.ColumnHeadersHeight), headerformat);
                x += grid.Columns[c].Width;
            }
            y += grid.ColumnHeadersHeight;
            for (int r = 0; r < grid.Rows.Count; r++)
            {
                x = grid.Location.X;
                for (int c = 0; c < grid.Columns.Count; c++)
                {
                    Color2 backcolor = GetBackColor(grid, r, c);
                    Color2 forecolor = GetForeColor(grid, r, c);
                    if (!backcolor.IsEmpty)
                    {
                        g.FillRectangle(new Brush2(backcolor), x, y, grid.Columns[c].Width, grid.Rows[r].Height);
                    }
                    g.DrawRectangle(p, x, y, grid.Columns[c].Width, grid.Rows[r].Height);
                    object value = grid.Rows[r].Cells[c].Value;
                    if (value != null)
                    {
                        Font2         font       = GraphUtils.ToFont2(grid.DefaultCellStyle.Font);
                        StringFormat2 cellformat = GetStringFormat(grid.Columns[c].DefaultCellStyle.Alignment);
                        string        t          = value.ToString();
                        if (!string.IsNullOrEmpty(grid.Columns[c].DefaultCellStyle.Format))
                        {
                            string format = "{0:" + grid.Columns[c].DefaultCellStyle.Format.ToLower() + "}";
                            t = string.Format(format, value);
                        }
                        g.DrawString(t, font, new Brush2(forecolor), new Rectangle2(x, y, grid.Columns[c].Width, grid.Rows[r].Height),
                                     cellformat);
                    }
                    x += grid.Columns[c].Width;
                }
                y += grid.Rows[r].Height;
            }
        }
        public override void OnPaintBackground(IGraphics g, int width, int height)
        {
            Brush2 b = new Brush2(Color2.FromArgb(236, 233, 216));

            g.FillRectangle(b, 0, 0, width, height);
            Pen2 p = new Pen2(Color2.FromArgb(172, 168, 153));

            g.DrawLine(p, 0, height - 1, width, height - 1);
            g.DrawLine(p, width - 1, 0, width - 1, height);
        }
        public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
        {
            int s2 = size / 2;

            g.FillEllipse(brush, x - s2, y - s2, size, size);
            if (pen != null)
            {
                g.DrawEllipse(pen, x - s2, y - s2, size, size);
            }
        }
Esempio n. 10
0
 public void FillRectangle(Brush2 brush, float x, float y, float width, float height)
 {
     if ((brush).Color.IsEmpty)
     {
         return;
     }
     SetBrush(brush);
     template.Rectangle(x, currentHeight - y, width, -height);
     template.Fill();
 }
        private void PaintIoPoint(IGraphics g, float x, float y, Brush2 brush, bool isOverview)
        {
            bool isOutside = x + ioCircleRadius <0 || x - ioCircleRadius> control.VisibleWidth / control.ZoomFactor ||
                             y + ioCircleRadius <0 || y - ioCircleRadius> control.VisibleHeight / control.ZoomFactor;

            if (!isOverview && isOutside)
            {
                return;
            }
            g.FillEllipse(brush, x - ioCircleRadius, y - ioCircleRadius, ioCircleRadius * 2, ioCircleRadius * 2);
            g.DrawEllipse(ioPen, x - ioCircleRadius, y - ioCircleRadius, ioCircleRadius * 2, ioCircleRadius * 2);
        }
Esempio n. 12
0
        public sealed override void OnPaintBackground(IGraphics g, int width, int height)
        {
            if (main == null)
            {
                return;
            }
            if (main.BackColor.IsEmpty || main.BackColor == Color.Transparent)
            {
                return;
            }
            Brush2 b = new Brush2(Color2.FromArgb(main.BackColor.A, main.BackColor.R, main.BackColor.G, main.BackColor.B));

            g.FillRectangle(b, 0, 0, width, height);
        }
Esempio n. 13
0
        public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF, StringFormat2 format)
        {
            template.BeginText();
            SetFont(font);
            SetBrush(brush);
            float x    = rectangleF.X;
            float y    = Math.Max(0, rectangleF.Y - rectangleF.Height / 2);
            Size2 size = MeasureString(s, font);

            if (format != null)
            {
                switch (format.Alignment)
                {
                case StringAlignment2.Center:
                    x = x + (rectangleF.Width - size.Width) / 2f;
                    break;

                case StringAlignment2.Near:
                    x = x + 2;
                    break;

                case StringAlignment2.Far:
                    x = x + (rectangleF.Width - size.Width) - 2;
                    break;
                }
                switch (format.LineAlignment)
                {
                case StringAlignment2.Center:
                    y = y + font.Height / 2f;
                    break;

                case StringAlignment2.Near:
                    y = y + 2;
                    break;

                case StringAlignment2.Far:
                    y = y + font.Height;
                    break;
                }
            }
            template.SetTextMatrix(x, currentHeight - y - font.Height * 0.5f * 1.5f);
            template.ShowText(s.TrimStart().TrimEnd());
            template.EndText();
        }
Esempio n. 14
0
 public void FillPolygon(Brush2 brush, Point2[] points)
 {
     SetBrush(brush);
     for (int index = 0; index < points.Length; index++)
     {
         Point2 point = points[index];
         if (index == 0)
         {
             template.MoveTo(point.X, currentHeight - point.Y);
         }
         else
         {
             template.LineTo(point.X, currentHeight - point.Y);
             template.Stroke();
             template.MoveTo(point.X, currentHeight - point.Y);
         }
     }
     template.Fill();
 }
        public void FillRoundedRactangle(Brush2 brush, float x, float y, float width, float height, float radius)
        {
            int          diameter = (int)(radius * 2);
            Size         size     = new Size(diameter, diameter);
            RectangleF   bounds   = new RectangleF(x, y, width, height);
            RectangleF   arc      = new RectangleF(bounds.Location, size);
            GraphicsPath path     = new GraphicsPath();

            try{
                path.AddArc(arc, 180, 90);
                arc.X = bounds.Right - diameter;
                path.AddArc(arc, 270, 90);
                arc.Y = bounds.Bottom - diameter;
                path.AddArc(arc, 0, 90);
                arc.X = bounds.Left;
                path.AddArc(arc, 90, 90);
            } catch (Exception) {}
            path.CloseFigure();
            gc.FillPath(GetBrush(brush), path);
        }
Esempio n. 16
0
 /// <summary>
 /// Fills the interior of an ellipse defined by a bounding rectangle specified by a pair of coordinates, a width, and a height.
 /// </summary>
 /// <param name="brush">System.Drawing.Brush that determines the characteristics of the fill.</param>
 /// <param name="x">The x-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
 /// <param name="y">The y-coordinate of the upper-left corner of the bounding rectangle that defines the ellipse.</param>
 /// <param name="width">Width of the bounding rectangle that defines the ellipse.</param>
 /// <param name="height">Height of the bounding rectangle that defines the ellipse.</param>
 public void FillEllipse(Brush2 brush, float x, float y, float width, float height)
 {
     if (width == height)
     {
         circleList.Add(new Circle {
             X         = x + width / 2f,
             Y         = y + height / 2f,
             R         = width,
             Fill      = BrushColor(brush),
             Transform = Transform
         });
     }
     else
     {
         ellipseList.Add(new Ellipse {
             Cx        = x,
             Cy        = y,
             Rx        = width,
             Ry        = height,
             Fill      = BrushColor(brush),
             Transform = Transform
         });
     }
 }
Esempio n. 17
0
 public void FillPolygon(Brush2 brush, Point2[] points)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 18
0
 public void DrawString(string s, Font2 font, Brush2 brush, Point2 location)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 19
0
 public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 20
0
 private void SetBrush(Brush2 b)
 {
     template.SetRGBColorFill(b.Color.R, b.Color.G, b.Color.B);
 }
Esempio n. 21
0
 public void FillRectangle(Brush2 brush, float x, float y, float width, float height)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 22
0
 public void FillRoundedRactangle(Brush2 brush, float x, float y, float width, float height, float radius)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 23
0
 public void FillClosedCurve(Brush2 brush, Point2[] points)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 24
0
 public void DrawString(string s, Font2 font, Brush2 brush, Point2 location)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 25
0
 public void DrawString(string s, Font2 font, Brush2 brush, float x, float y)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 26
0
 public void FillPolygon(Brush2 brush, Point2[] points)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 27
0
 public void DrawString(string s, Font2 font, Brush2 brush, Point2 point, StringFormat2 format)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 28
0
 public void FillClosedCurve(Brush2 brush, Point2[] points)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 29
0
 public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 30
0
 private static void DrawString(IGraphics g, string s, Font2 font, Brush2 brush, float x, float y)
 {
     try{
         g.DrawString(s, font, brush, x, y);
     } catch (Exception) {}
 }
Esempio n. 31
0
 public void FillRectangle(Brush2 brush, float x, float y, float width, float height)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 32
0
 public void DrawString(string s, Font2 font, Brush2 brush, Point2 point, StringFormat2 format)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 33
0
 public void DrawString(string s, Font2 font, Brush2 brush, Rectangle2 rectangleF)
 {
     DrawString(s, font, brush, rectangleF, new StringFormat2());
 }
Esempio n. 34
0
 public void FillRoundedRactangle(Brush2 brush, float x, float y, float width, float height, float radius)
 {
     throw new System.NotImplementedException();
 }
Esempio n. 35
0
        public void OnPaint(IGraphics g, int xm, int ym, int width, int height)
        {
            if (!Visible)
            {
                return;
            }
            if (TotalMax == double.NegativeInfinity)
            {
                return;
            }
            if ((indicator1 != -1 && indicator2 != -1) || (ZoomType == AxisZoomType.Indicate && !IsFullZoom()))
            {
                if (IsValid())
                {
                    PaintIndicator(g, width, height);
                }
            }
            Pen2   forePen     = new Pen2(ForeColor, LineWidth);
            Pen2   majorTicPen = new Pen2(ForeColor, MajorTickLineWidth);
            Pen2   minorTicPen = new Pen2(ForeColor, MinorTickLineWidth);
            Brush2 brush       = new Brush2(ForeColor);

            g.SmoothingMode = SmoothingMode2.AntiAlias;
            string label = Text ?? "";
            float  x0;
            float  y0;
            int    decade = 0;

            double[][] tics = null;
            double     max  = 0;

            if (IsValid())
            {
                decade = (int)Math.Floor(Math.Log(Math.Max(Math.Abs(VisibleMax), Math.Abs(VisibleMin))) / Math.Log(10));
                if (decade > 0 && decade < MaxNumIntegerDigits)
                {
                    decade = 0;
                }
                if (decade != 0 && !IsLogarithmic)
                {
                    label += " [1" + ToSuperscript(decade) + ']';
                }
                tics = GetTics(GetLength(width, height));
                if (tics == null)
                {
                    return;
                }
                max = Math.Max(Math.Abs(ArrayUtils.Max(tics[0])), Math.Abs(ArrayUtils.Min(tics[0])));
            }
            Font2 font = labelFont;

            while (g.MeasureString(label, font).Width > Math.Max(width, height) * 0.95f && font.Size > 5f)
            {
                font = new Font2(font.Name, font.Size - 0.5f, font.Style);
            }
            switch (Positioning)
            {
            case AxisPositioning.Top:
                y0 = height - 1;
                g.DrawLine(forePen, xm, ym + y0, xm + width, ym + y0);
                if (IsValid() && tics != null)
                {
                    int previousstringEnd = -Sign * int.MaxValue;
                    for (int i = 0; i < tics[0].Length; i++)
                    {
                        x0 = ModelToView(tics[0][i], width, height);
                        g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 - MajorTickLength);
                        string s   = GetTicLabel(tics[0][i], decade, max);
                        int    w   = (int)g.MeasureString(s, numbersFont).Width;
                        int    pos = (int)(x0 - w / 2.0);
                        pos = Math.Max(-2, pos);
                        pos = Math.Min(width - w + 2, pos);
                        if (Sign * pos > Sign * previousstringEnd)
                        {
                            DrawString(g, s, numbersFont, brush, xm + pos + 1, ym + y0 - MajorTickLength - numbersFont.Height);
                            previousstringEnd = pos + Sign * w;
                        }
                    }
                    for (int i = 0; i < tics[1].Length; i++)
                    {
                        x0 = ModelToView(tics[1][i], width, height);
                        g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 - MinorTickLength);
                    }
                }
                DrawString(g, label, font, brush, xm + (width) / 2 - (int)g.MeasureString(label, font).Width / 2,
                           ym + y0 - MajorTickLength - labelFont.Height - 12);
                break;

            case AxisPositioning.Left:
                x0 = width - 1;
                g.DrawLine(forePen, xm + x0, ym, xm + x0, ym + height);
                if (IsValid() && tics != null)
                {
                    int previousstringEnd = -Sign * Int32.MaxValue;
                    for (int i = 0; i < tics[0].Length; i++)
                    {
                        y0 = ModelToView(tics[0][i], width, height);
                        g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0 - MajorTickLength, ym + y0);
                        string s   = GetTicLabel(tics[0][i], decade, max);
                        int    w   = (int)g.MeasureString(s, numbersFont).Width;
                        int    pos = (int)(y0 + w / 2.0) + 1;
                        pos = Math.Max(w - 2, pos);
                        pos = Math.Min(height + 2, pos);
                        if (Sign * pos > Sign * previousstringEnd)
                        {
                            g.RotateTransform(-90);
                            DrawString(g, s, numbersFont, brush, -pos - ym, xm + x0 - MajorTickLength - numbersFont.Height);
                            g.RotateTransform(90);
                            previousstringEnd = pos + Sign * w;
                        }
                    }
                    for (int i = 0; i < tics[1].Length; i++)
                    {
                        y0 = ModelToView(tics[1][i], width, height);
                        g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0 - MinorTickLength, ym + y0);
                    }
                }
                g.RotateTransform(-90);
                float x = -height / 2 - (int)g.MeasureString(label, font).Width / 2;
                float y = x0 - MajorTickLength - labelFont.Height - numbersFont.Height - 10;
                if (y < 0)
                {
                    y = 0;
                }
                DrawString(g, label, font, brush, -ym + x, xm + y - 2);
                g.RotateTransform(90);
                break;

            case AxisPositioning.Bottom:
                y0 = 0;
                g.DrawLine(forePen, xm, ym + y0, xm + width, ym + y0);
                if (IsValid() && tics != null)
                {
                    int previousstringEnd = -Sign * Int32.MaxValue;
                    for (int i = 0; i < tics[0].Length; i++)
                    {
                        x0 = ModelToView(tics[0][i], width, height);
                        g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 + MajorTickLength);
                        string s   = GetTicLabel(tics[0][i], decade, max);
                        int    w   = (int)g.MeasureString(s, numbersFont).Width;
                        int    pos = (int)(x0 - w / 2.0);
                        pos = Math.Max(-2, pos);
                        pos = Math.Min(width - w + 2, pos);
                        if (Sign * pos > Sign * previousstringEnd)
                        {
                            DrawString(g, s, numbersFont, brush, xm + pos + 1, ym + y0 + 1 + MajorTickLength - 1);
                            previousstringEnd = pos + Sign * w;
                        }
                    }
                    for (int i = 0; i < tics[1].Length; i++)
                    {
                        x0 = ModelToView(tics[1][i], width, height);
                        g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0, ym + y0 + MinorTickLength);
                    }
                }
                DrawString(g, label, font, brush, xm + (width) / 2 - (int)g.MeasureString(label, font).Width / 2,
                           ym + y0 + MajorTickLength + 12);
                break;

            case AxisPositioning.Right:
                x0 = 0;
                g.DrawLine(forePen, xm + x0, ym, xm + x0, ym + height);
                if (IsValid() && tics != null)
                {
                    int previousstringEnd = -Sign * Int32.MaxValue;
                    for (int i = 0; i < tics[0].Length; i++)
                    {
                        y0 = ModelToView(tics[0][i], width, height);
                        g.DrawLine(majorTicPen, xm + x0, ym + y0, xm + x0 + MajorTickLength, ym + y0);
                        string s   = GetTicLabel(tics[0][i], decade, max);
                        int    w   = (int)g.MeasureString(s, numbersFont).Width;
                        int    pos = (int)(y0 - w / 2.0);
                        pos = Math.Max(-2, pos);
                        pos = Math.Min(height - w + 2, pos);
                        if (Sign * pos > Sign * previousstringEnd)
                        {
                            g.RotateTransform(90);
                            DrawString(g, s, numbersFont, brush, ym + pos + 1, -xm - MajorTickLength - numbersFont.Height * 0.99f);
                            g.RotateTransform(-90);
                            previousstringEnd = pos + Sign * w;
                        }
                    }
                    for (int i = 0; i < tics[1].Length; i++)
                    {
                        y0 = ModelToView(tics[1][i], width, height);
                        g.DrawLine(minorTicPen, xm + x0, ym + y0, xm + x0 + MinorTickLength, ym + y0);
                    }
                }
                g.RotateTransform(90);
                DrawString(g, label, font, brush, ym + height / 2 - (int)g.MeasureString(label, font).Width / 2,
                           -xm - MajorTickLength - numbersFont.Height - labelFont.Height - 3);
                g.RotateTransform(-90);
                break;
            }
        }
Esempio n. 36
0
 public void DrawString(string s, Font2 font, Brush2 brush, Point2 location)
 {
     DrawString(s, font, brush, new Rectangle2(location, new Size2(0, 0)), new StringFormat2());
 }
Esempio n. 37
0
        private void PaintMarkers(IGraphics g, int off, int width, int height)
        {
            Pen2 fgPen = new Pen2(ForeColor);

            for (int i = 0; i < Colors.Count; i++)
            {
                Pen2 p = new Pen2(Colors[i]);
                int  a = ModelToView(Positions[i], width, height);
                int  d = (i == mouseOverIndex) && (Arrow == Arrows.First || Arrow == Arrows.Both) ? triangleHeight : 0;
                if (Vertical)
                {
                    int e = ((i == mouseOverIndex)) && (Arrow == Arrows.Second || Arrow == Arrows.Both)
                                                ? width - 1 - triangleHeight : width - 1;
                    g.DrawLine(p, 0, a, width - 1, a);
                    g.DrawLine(fgPen, d, a - 1, off - 1, a - 1);
                    g.DrawLine(fgPen, d, a + 1, off - 1, a + 1);
                    g.DrawLine(fgPen, off + StripWidth + 1, a - 1, e, a - 1);
                    g.DrawLine(fgPen, off + StripWidth + 1, a + 1, e, a + 1);
                }
                else
                {
                    int e = (i == mouseOverIndex) && (Arrow == Arrows.Second || Arrow == Arrows.Both)
                                                ? height - 1 - triangleHeight : height - 1;
                    g.DrawLine(p, a, 0, a, height - 1);
                    g.DrawLine(fgPen, a - 1, d, a - 1, off - 1);
                    g.DrawLine(fgPen, a + 1, d, a + 1, off - 1);
                    g.DrawLine(fgPen, a - 1, off + StripWidth + 1, a - 1, e);
                    g.DrawLine(fgPen, a + 1, off + StripWidth + 1, a + 1, e);
                }
                if (i == mouseOverIndex)
                {
                    Brush2 b = new Brush2(p.Color);
                    if (Vertical)
                    {
                        if (Arrow == Arrows.Second || Arrow == Arrows.Both)
                        {
                            Point2[] points =
                            {
                                new Point2(width - 1 - triangleHeight, a - 1), new Point2(width - 1 - triangleHeight, a - triangleBase2),
                                new Point2(width - 1,                  a),     new Point2(width - 1 - triangleHeight, a + triangleBase2),
                                new Point2(width - 1 - triangleHeight, a + 1)
                            };
                            g.FillClosedCurve(b, points);
                            g.DrawCurve(fgPen, points);
                        }
                        if (Arrow == Arrows.First || Arrow == Arrows.Both)
                        {
                            Point2[] points =
                            {
                                new Point2(triangleHeight, a - 1),             new Point2(triangleHeight, a - triangleBase2), new Point2(0, a),
                                new Point2(triangleHeight, a + triangleBase2), new Point2(triangleHeight, a + 1)
                            };
                            g.FillClosedCurve(b, points);
                            g.DrawCurve(fgPen, points);
                        }
                    }
                    else
                    {
                        Point2[] points =
                        {
                            new Point2(a - 1, height - 1 - triangleHeight), new Point2(a - triangleBase2, height - 1 - triangleHeight),
                            new Point2(a,     height - 1),                  new Point2(a + triangleBase2, height - 1 - triangleHeight),
                            new Point2(a + 1, height - 1 - triangleHeight)
                        };
                        g.FillClosedCurve(b, points);
                        g.DrawCurve(fgPen, points);
                        points = new[] {
                            new Point2(a - 1, triangleHeight), new Point2(a - triangleBase2, triangleHeight), new Point2(a, 0),
                            new Point2(a + triangleBase2, triangleHeight), new Point2(a + 1, triangleHeight)
                        };
                        g.FillClosedCurve(b, points);
                        g.DrawCurve(fgPen, points);
                    }
                }
            }
        }
Esempio n. 38
0
 public void DrawString(string s, Font2 font, Brush2 brush, float x, float y)
 {
     throw new System.NotImplementedException();
 }