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.FillPolygon(brush, points);
     g.DrawPolygon(pen, points);
 }
        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);
        }
示例#3
0
 /// <summary>
 /// Draws an ellipse defined by a bounding rectangle specified by coordinates for the upper-left corner of
 /// the rectangle, a height, and a width.
 /// </summary>
 /// <param name="pen">Pen that determines the color, width, and style of the ellipse.</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 DrawEllipse(Pen2 pen, 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        = "none",
             Stroke      = pen.Color.Name,
             StrokeWidth = pen.Width,
             Transform   = Transform
         });
     }
     else
     {
         ellipseList.Add(new Ellipse {
             Cx          = x,
             Cy          = y,
             Rx          = width,
             Ry          = height,
             Fill        = "none",
             Stroke      = pen.Color.Name,
             StrokeWidth = pen.Width,
             Transform   = Transform
         });
     }
 }
示例#4
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pen"></param>
        /// <param name="points"></param>
        public void DrawLines(Pen2 pen, Point2[] points)
        {
            Path path = new Path {
                D = "", Transform = Transform
            };

            for (int i = 0; i < points.Length; i++)
            {
                if (i == 0)
                {
                    path.D += $"M{points[i].X} {points[i].Y} ";
                }
                else
                {
                    path.D += $"L{points[i].X} {points[i].Y} ";
                }
            }
            path.Stroke      = PenColor(pen);
            path.StrokeWidth = pen.Width;
            path.Fill        = "none";
            if (pen.DashStyle != DashStyle2.Solid)
            {
                path.StrokeDashArray = "1, 1";
            }
            //path.D = path.D + " Z";
            pathList.Add(path);
        }
示例#5
0
 public void DrawLine(Pen2 pen, float x1, float y1, float x2, float y2)
 {
     SetPen(pen);
     template.MoveTo(x1, currentHeight - y1);
     template.LineTo(x2, currentHeight - y2);
     template.Stroke();
 }
示例#6
0
        private void SetPen(Pen2 pen)
        {
            template.SetRGBColorStroke(pen.Color.R, pen.Color.G, pen.Color.B);
            template.SetLineWidth(pen.Width);
            switch (pen.DashCap)
            {
            case DashCap2.Round:
                template.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
                break;
            }
            switch (pen.DashStyle)
            {
            case DashStyle2.Solid:
                template.SetLineDash(0f);
                break;

            case DashStyle2.Dash:
                template.SetLineDash(pen.DashPattern, pen.DashOffset);
                break;

            case DashStyle2.Custom:
                template.SetLineDash(pen.DashPattern, pen.DashOffset);
                break;
            }
        }
示例#7
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);
        }
示例#8
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);
        }
示例#9
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)));
                }
            }
        }
示例#10
0
        private void PaintStrip(IGraphics g, int off, int width, int height)
        {
            Pen2 fgPen = new Pen2(ForeColor);

            if (Vertical)
            {
                g.DrawLine(fgPen, off - 1, 0, off - 1, height - 1);
                g.DrawLine(fgPen, off + StripWidth + 1, 0, off + StripWidth + 1, height - 1);
            }
            else
            {
                g.DrawLine(fgPen, 0, off - 1, width - 1, off - 1);
                g.DrawLine(fgPen, 0, off + StripWidth + 1, width - 1, off + StripWidth + 1);
            }
            if (refreshColors)
            {
                CalcGradient(width, height);
                if (fireChange)
                {
                    FireColorChanged();
                    fireChange = false;
                }
            }
            PaintGradient(g, off, width, height);
            refreshColors = false;
        }
        public void DrawInterceptedLine(Pen2 pen, float x1, float y1, float x2, float y2, float len)
        {
            gc.DrawLine(GetPen(pen), x1, y1, x2, y2);
            float x3, x4, y3, y4;

            if (y1.Equals(y2))
            {
                x3 = x2;
                x4 = x2;
                y3 = y2 - len;
                y4 = y2 + len;
            }
            else if (x1.Equals(x2))
            {
                y3 = y2;
                y4 = y2;
                x3 = x2 - len;
                x4 = x2 + len;
            }
            else
            {
                float m  = -1 / ((y2 - y1) / (x2 - x1));
                float m2 = m * m;
                float sq = (float)Math.Sqrt(1 + m2);
                x3 = x2 + len / sq;
                y3 = y2 + m * len / sq;
                x4 = x2 - len / sq;
                y4 = y2 - m * len / sq;
            }
            gc.DrawLine(GetPen(pen), x3, y3, x4, y4);
        }
 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);
     }
 }
示例#13
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, x + s2, y);
     g.DrawLine(pen, x, y - s2, x, y + s2);
     g.DrawLine(pen, x - s2, y - s2, x + s2, y + s2);
     g.DrawLine(pen, x + s2, y - s2, x - s2, y + s2);
 }
示例#14
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 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);
            }
        }
        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);
        }
示例#17
0
 private void CalcGradient(Color2 c1, Color2 c2, int a1, int a2)
 {
     for (int j = a1 + 1; j <= a2; j++)
     {
         double w1 = Math.Abs(a2 - j);
         double w2 = Math.Abs(j - a1);
         byte   rr = (byte)Math.Round((c1.R * w1 + c2.R * w2) / (w1 + w2));
         byte   gg = (byte)Math.Round((c1.G * w1 + c2.G * w2) / (w1 + w2));
         byte   bb = (byte)Math.Round((c1.B * w1 + c2.B * w2) / (w1 + w2));
         precalcColors[j] = Color2.FromArgb(rr, gg, bb);
         precalcPens[j]   = new Pen2(precalcColors[j]);
     }
 }
示例#18
0
        /// <summary>
        /// Draws a line connecting the two points specified by the coordinate pairs.
        /// </summary>
        /// <param name="pen">Pen that determines the color, width, and style of the line.</param>
        /// <param name="x1">The x-coordinate of the first point.</param>
        /// <param name="y1">The y-coordinate of the first point. </param>
        /// <param name="x2">The x-coordinate of the second point.</param>
        /// <param name="y2">The y-coordinate of the second point. </param>
        public void DrawLine(Pen2 pen, float x1, float y1, float x2, float y2)
        {
            Line line = new Line {
                X1          = x1,
                X2          = x2,
                Y1          = y1,
                Y2          = y2,
                Transform   = Transform,
                Stroke      = PenColor(pen),
                Strokewidth = pen.Width
            };

            lines.Add(line);
        }
示例#19
0
        /// <summary>
        /// Draws a rectangle specified by a coordinate pair, a width, and a height.
        /// </summary>
        /// <param name="pen">Pen  that determines the color, width, and style of the rectangle.</param>
        /// <param name="x">The x-coordinate of the upper-left corner of the rectangle to draw.</param>
        /// <param name="y">The y-coordinate of the upper-left corner of the rectangle to draw.</param>
        /// <param name="width">Width of the rectangle to draw.</param>
        /// <param name="height">Height of the rectangle to draw.</param>
        public void DrawRectangle(Pen2 pen, float x, float y, float width, float height)
        {
            Rect rect = new Rect {
                X           = x,
                Y           = y,
                Width       = width,
                Height      = height,
                Fill        = "none",
                Transform   = Transform,
                Stroke      = pen.Color.Name,
                StrokeWidth = pen.Width
            };

            rectList.Add(rect);
        }
示例#20
0
 private void PaintGradient(IGraphics g, int off, int width, int height)
 {
     for (int j = 0; j < GetLength(width, height); j++)
     {
         Pen2 x = precalcPens[j];
         if (Vertical)
         {
             g.DrawLine(x, off, j, off + StripWidth, j);
         }
         else
         {
             g.DrawLine(x, j, off, j, off + StripWidth);
         }
     }
 }
        public override void OnPaintBackground(IGraphics g, int width, int height)
        {
            Pen2 p = new Pen2(Color2.FromArgb(172, 168, 153));

            g.DrawLine(p, width - 1, 0, width - 1, height);
            int[][] rgbs = GraphUtil.InterpolateRgb(243, 241, 236, 254, 254, 251, GraphUtil.scrollBarWidth - 2);
            for (int i = 0; i < GraphUtil.scrollBarWidth - 2; i++)
            {
                p = new Pen2(Color2.FromArgb(rgbs[0][i], rgbs[1][i], rgbs[2][i]));
                g.DrawLine(p, i + 1, 0, i + 1, height);
            }
            p = new Pen2(Color2.FromArgb(238, 237, 229));
            g.DrawLine(p, 0, 0, 0, height);
            g.DrawLine(p, width - 2, 0, width - 2, height);
        }
示例#22
0
 public void DrawPath(Pen2 pen, GraphicsPath2 path)
 {
     SetPen(pen);
     for (int index = 0; index < path.PathPoints.Length; index++)
     {
         Point2 point = path.PathPoints[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.Stroke();
 }
示例#23
0
 public void DrawPolygon(Pen2 pen, Point2[] points)
 {
     SetPen(pen);
     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.Stroke();
 }
        public void DrawRoundedRectangle(Pen2 pen, float x, float y, float width, float height, float radius)
        {
            float        diameter = radius * 2;
            Size         size     = new Size((int)diameter, (int)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 = (int)(bounds.Right - diameter);
                path.AddArc(arc, 270, 90);
                arc.Y = (int)(bounds.Bottom - diameter);
                path.AddArc(arc, 0, 90);
                arc.X = bounds.Left;
                path.AddArc(arc, 90, 90);
            } catch (Exception) {}
            path.CloseFigure();
            gc.DrawPath(GetPen(pen), path);
        }
示例#25
0
 /// <summary>
 /// Draws a rectangle specified by a coordinate pair, a width, and a height.
 /// </summary>
 /// <param name="pen">Pen  that determines the color, width, and style of the rectangle.</param>
 /// <param name="x">The x-coordinate of the upper-left corner of the rectangle to draw.</param>
 /// <param name="y">The y-coordinate of the upper-left corner of the rectangle to draw.</param>
 /// <param name="width">Width of the rectangle to draw.</param>
 /// <param name="height">Height of the rectangle to draw.</param>
 public void DrawRectangle(Pen2 pen, float x, float y, float width, float height)
 {
     Rect rect = new Rect{
         X = x,
         Y = y,
         Width = width,
         Height = height,
         Fill = "none",
         Transform = Transform,
         Stroke = pen.Color.Name,
         StrokeWidth = pen.Width
     };
     rectList.Add(rect);
 }
示例#26
0
 public void DrawPolygon(Pen2 pen, Point2[] points)
 {
     throw new System.NotImplementedException();
 }
示例#27
0
 public void DrawRoundedRectangle(Pen2 pen, float x, float y, float width, float height, float radius)
 {
     throw new System.NotImplementedException();
 }
示例#28
0
 public void DrawPath(Pen2 pen, GraphicsPath2 path)
 {
     throw new System.NotImplementedException();
 }
示例#29
0
 public void DrawInterceptedLine(Pen2 pen, float x1, float y1, float x2, float y2, float len)
 {
     throw new System.NotImplementedException();
 }
示例#30
0
 public override void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush)
 {
     int s2 = size/2;
     g.DrawRectangle(pen, x - s2, y - s2, size, size);
 }
示例#31
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;
     }
 }
示例#32
0
 /// <summary>
 /// 
 /// </summary>
 /// <param name="pen"></param>
 /// <param name="points"></param>
 public void DrawLines(Pen2 pen, Point2[] points)
 {
     Path path = new Path{D = "", Transform = Transform};
     for (int i = 0; i < points.Length; i++){
         if (i == 0){
             path.D += $"M{points[i].X} {points[i].Y} ";
         } else{
             path.D += $"L{points[i].X} {points[i].Y} ";
         }
     }
     path.Stroke = PenColor(pen);
     path.StrokeWidth = pen.Width;
     path.Fill = "none";
     if (pen.DashStyle != DashStyle2.Solid){
         path.StrokeDashArray = "1, 1";
     }
     //path.D = path.D + " Z";
     pathList.Add(path);
 }
示例#33
0
 public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size, bool selected)
 {
     if (selected){
         g.FillEllipse(Brushes2.Red, x - 1, y - 1, size + 2, size + 2);
     }
     g.FillEllipse(b, x, y, size, size);
     g.DrawEllipse(w, x + 2, y + 2, size - 4, size - 4);
 }
示例#34
0
 public void DrawRectangle(Pen2 pen, float x, float y, float width, float height)
 {
     SetPen(pen);
     template.Rectangle(x, currentHeight - y, width, -height);
     template.Stroke();
 }
示例#35
0
 public void DrawRoundedRectangle(Pen2 pen, float x, float y, float width, float height, float radius)
 {
     throw new NotImplementedException();
 }
示例#36
0
 private void SetPen(Pen2 pen)
 {
     template.SetRGBColorStroke(pen.Color.R, pen.Color.G, pen.Color.B);
     template.SetLineWidth(pen.Width);
     switch (pen.DashCap){
         case DashCap2.Round:
             template.SetLineCap(PdfContentByte.LINE_CAP_ROUND);
             break;
     }
     switch (pen.DashStyle){
         case DashStyle2.Solid:
             template.SetLineDash(0f);
             break;
         case DashStyle2.Dash:
             template.SetLineDash(pen.DashPattern, pen.DashOffset);
             break;
         case DashStyle2.Custom:
             template.SetLineDash(pen.DashPattern, pen.DashOffset);
             break;
     }
 }
示例#37
0
 public void DrawArc(Pen2 pen, Rectangle2 rec, float startAngle, float sweepAngle)
 {
     throw new NotImplementedException();
 }
示例#38
0
 public void DrawPolygon(Pen2 pen, Point2[] points)
 {
     throw new NotImplementedException();
 }
示例#39
0
 public static void PaintRoundButton(IGraphics g, Brush2 b, Pen2 w, int x, int y, int size)
 {
     PaintRoundButton(g, b, w, x, y, size, false);
 }
示例#40
0
 public void DrawPolygon(Pen2 pen, Point2[] points)
 {
     SetPen(pen);
     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.Stroke();
 }
示例#41
0
 public void DrawInterceptedLine(Pen2 pen, float x1, float y1, float x2, float y2, float len)
 {
     throw new NotImplementedException();
 }
示例#42
0
 public void DrawPath(Pen2 pen, GraphicsPath2 path)
 {
     SetPen(pen);
     for (int index = 0; index < path.PathPoints.Length; index++){
         Point2 point = path.PathPoints[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.Stroke();
 }
示例#43
0
 public void DrawEllipse(Pen2 pen, float x, float y, float width, float height)
 {
     SetPen(pen);
     template.Ellipse(x, currentHeight - y, x + width, currentHeight - (y + height));
     template.Stroke();
 }
示例#44
0
 public static void PaintPlusZoomButton(IGraphics g, Brush2 b, int x, int y, int bsize)
 {
     Pen2 w = new Pen2(Color2.White, 2);
     PaintRoundButton(g, b, w, x, y, bsize);
     g.DrawLine(w, x + 4, y + bsize/2, x + bsize - 4, y + bsize/2);
     g.DrawLine(w, x + bsize - bsize/2, y + 4, x + bsize/2, y + bsize - 4);
 }
示例#45
0
 public void DrawArrow(Pen2 pen, float x1, float y1, float x2, float y2, float side)
 {
     throw new System.NotImplementedException();
 }
 public override void OnPaintBackground(IGraphics g, int width, int height)
 {
     Pen2 p = new Pen2(Color2.FromArgb(172, 168, 153));
     g.DrawLine(p, width - 1, 0, width - 1, height);
     int[][] rgbs = GraphUtil.InterpolateRgb(243, 241, 236, 254, 254, 251, GraphUtil.scrollBarWidth - 2);
     for (int i = 0; i < GraphUtil.scrollBarWidth - 2; i++){
         p = new Pen2(Color2.FromArgb(rgbs[0][i], rgbs[1][i], rgbs[2][i]));
         g.DrawLine(p, i + 1, 0, i + 1, height);
     }
     p = new Pen2(Color2.FromArgb(238, 237, 229));
     g.DrawLine(p, 0, 0, 0, height);
     g.DrawLine(p, width - 2, 0, width - 2, height);
 }
示例#47
0
 public void DrawEllipse(Pen2 pen, float x, float y, float width, float height)
 {
     throw new System.NotImplementedException();
 }
示例#48
0
 /// <summary>
 /// Draws a GraphicsPath.
 /// </summary>
 /// <param name="pen">Pen that determines the color, width, and style of the path.</param>
 /// <param name="path">GraphicsPath to draw.</param>
 public void DrawPath(Pen2 pen, GraphicsPath2 path)
 {
     DrawLines(pen, path.PathPoints);
 }
示例#49
0
 public void DrawArc(Pen2 pen, Rectangle2 rec, float startAngle, float sweepAngle)
 {
     throw new System.NotImplementedException();
 }
示例#50
0
 public void DrawCurve(Pen2 pen, Point2[] points)
 {
     DrawPolygon(pen, points);
 }
示例#51
0
 public string PenColor(Pen2 pen)
 {
     return GetColor(pen.Color);
 }
示例#52
0
 public void DrawLine(Pen2 pen, float x1, float y1, float x2, float y2, string title, string description)
 {
     DrawLine(pen, x1, y1, x2, y2);
 }
示例#53
0
 public static void PaintMoveUpButton(IGraphics g, Brush2 b, int x, int y, int bsize)
 {
     Pen2 w = new Pen2(Color2.White, 2);
     PaintRoundButton(g, b, w, x, y, bsize);
     g.FillClosedCurve(Brushes2.White,
         new[]{new Point2(x + bsize/2, y + 4), new Point2(x + 5, y + bsize - 4), new Point2(x + bsize - 5, y + bsize - 4)});
 }
示例#54
0
 public void DrawLine(Pen2 pen, float x1, float y1, float x2, float y2)
 {
     SetPen(pen);
     template.MoveTo(x1, currentHeight - y1);
     template.LineTo(x2, currentHeight - y2);
     template.Stroke();
 }
示例#55
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;
            }
        }
示例#56
0
 public abstract void Draw(int size, float x, float y, IGraphics g, Pen2 pen, Brush2 brush);
示例#57
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;
     }
 }
示例#58
0
 public void DrawArrow(Pen2 pen, float x1, float y1, float x2, float y2, float side)
 {
     throw new NotImplementedException();
 }
示例#59
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);
                    }
                }
            }
        }
示例#60
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)));
         }
     }
 }