Example #1
0
        //djl
        public void Draw(CanvasWrapper canvas, RectangleF unitrect, int start, int end, int line, int strong)
        {
            if (Enabled == false)
            {
                return;
            }

            float gridX = m_spacing.Width;
            float gridY = m_spacing.Height;
            //Console.WriteLine("gridX=" + gridX + " ; Y=" + gridY);
            float gridscreensizeX = canvas.ToScreen(gridX);
            float gridscreensizeY = canvas.ToScreen(gridY);

            //Console.WriteLine("gridscreensizeX=" + gridscreensizeX + " ; Y=" + gridscreensizeY);
            if (gridscreensizeX < m_minSize || gridscreensizeY < m_minSize)
            {
                return;
            }

            PointF leftpoint  = unitrect.Location;
            PointF rightpoint = ScreenUtils.RightPoint(canvas, unitrect);

            float left   = (float)Math.Round(leftpoint.X / gridX) * gridX;
            float top    = unitrect.Height + unitrect.Y;
            float right  = rightpoint.X;
            float bottom = (float)Math.Round(leftpoint.Y / gridY) * gridY;

            GraphicsPath path = new GraphicsPath();
            PointF       p1;
            PointF       p2;

            if (true)
            {
                Console.WriteLine("left=" + left + " ; top=" + top + " ; right=" + right + " ; bottom=" + bottom
                                  + "; start=" + start + ";end=" + end + ";line=" + line);
                p1 = canvas.ToScreen(new UnitPoint(leftpoint.X + start, top - line * gridY));
                p2 = canvas.ToScreen(new UnitPoint(leftpoint.X + end, top - line * gridY));
            }
            try
            {
                Line l = new Line(p1, p2, strong);
                CanvasCtrl.M_canvas.List.Add(l);
                canvas.Graphics.DrawLine(new Pen(l.Color, 2), p1, p2);
            }
            catch (Exception e)
            {
                Console.Write(e.Message);
            }
        }
Example #2
0
        public void Draw(CanvasWrapper canvas, RectangleF unitrect, int start, int end, int time, int strong)
        {
            if (Enabled == false)
            {
                return;
            }

            float gridX = Spacing.Width;
            float gridY = Spacing.Height;
            //Console.WriteLine("gridX=" + gridX + " ; Y=" + gridY);
            float gridscreensizeX = canvas.ToScreen(gridX);
            float gridscreensizeY = canvas.ToScreen(gridY);

            //Console.WriteLine("gridscreensizeX=" + gridscreensizeX + " ; Y=" + gridscreensizeY);
            if (gridscreensizeX < MinSize || gridscreensizeY < MinSize)
            {
                return;
            }

            PointF leftpoint  = unitrect.Location;
            PointF rightpoint = ScreenUtils.RightPoint(canvas, unitrect);

            float left   = (float)Math.Round(leftpoint.X / gridX) * gridX;
            float top    = unitrect.Height + unitrect.Y;
            float right  = rightpoint.X;
            float bottom = (float)Math.Round(leftpoint.Y / gridY) * gridY;


            //Console.WriteLine("left=" + left + " ; top=" + top + " ; right=" + right + " ; bottom=" + bottom);

            Pen          pen  = new Pen(d_color);
            GraphicsPath path = new GraphicsPath();

            while (bottom < top)
            {
                PointF p1 = canvas.ToScreen(new UnitPoint(leftpoint.X, bottom));
                PointF p2 = canvas.ToScreen(new UnitPoint(rightpoint.X, bottom));
                path.AddLine(p1, p2);
                path.CloseFigure();
                bottom += gridY;
            }

            if (canvas.Graphics != null)
            {
                canvas.Graphics.DrawPath(pen, path);
            }
        }
Example #3
0
        public void Draw(ICanvas canvas, RectangleF unitrect)
        {
            if (Enabled == false)
            {
                return;
            }

            float gridX = Spacing.Width;
            float gridY = Spacing.Height;
            //Console.WriteLine("gridX=" + gridX + " ; Y=" + gridY);
            float gridscreensizeX = canvas.ToScreen(gridX);
            float gridscreensizeY = canvas.ToScreen(gridY);

            //Console.WriteLine("gridscreensizeX=" + gridscreensizeX + " ; Y=" + gridscreensizeY);
            if (gridscreensizeX < MinSize || gridscreensizeY < MinSize)
            {
                return;
            }

            PointF leftpoint  = unitrect.Location;
            PointF rightpoint = ScreenUtils.RightPoint(canvas, unitrect);

            float left   = (float)Math.Round(leftpoint.X / gridX) * gridX;
            float top    = unitrect.Height + unitrect.Y;
            float right  = rightpoint.X;
            float bottom = (float)Math.Round(leftpoint.Y / gridY) * gridY;


            // Console.WriteLine("left=" + left + " ; top=" + top + " ; right=" + right + " ; bottom=" + bottom);
            Pen          pen  = new Pen(m_color);
            GraphicsPath path = new GraphicsPath();

            // 蓝色底格

            /*
             *
             *
             * while (bottom < top)
             * {
             *  PointF p1 = canvas.ToScreen(new UnitPoint(-20, bottom));
             *  PointF p2 = canvas.ToScreen(new UnitPoint(180, bottom));
             *  path.AddLine(p1, p2);
             *  path.CloseFigure();
             *  bottom += gridY;
             * }
             * canvas.Graphics.DrawPath(pen, path);
             *
             */
            //画基架括号
            //      Image newImage = Image.FromFile("d:\\CSARP\\1.jpg");//建立要绘制的Image图像



            right = 174;
            pen   = new Pen(l_color);
            path.Reset();
            left = 10;
            int pailine = 14;

            top = (float)Math.Round(top);
            while (left < right)
            {
                bottom = 10;
                while (bottom < top)
                {
                    PointF p1 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p2 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 1;
                    path.AddLine(p1, p2);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p3 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p4 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 1 + 3 * i, top - bottom));
                        path.AddLine(p3, p4);
                        path.CloseFigure();
                    }
                    bottom += 2;

                    PointF p5 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p6 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p5, p6);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p7 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p8 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 1 + 3 * i, top - bottom));
                        path.AddLine(p7, p8);
                        path.CloseFigure();
                    }
                    bottom += 1;

                    PointF p9  = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p10 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p9, p10);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p11 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p12 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p11, p12);
                        path.CloseFigure();
                    }
                    bottom += 2;
                    PointF p13 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p14 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p13, p14);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p15 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p16 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p15, p16);
                        path.CloseFigure();
                    }
                    bottom += 1;
                    PointF p17 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p18 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 7;
                    path.AddLine(p17, p18);
                    path.CloseFigure();



                    PointF p19 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p20 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p19, p20);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p21 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p22 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p21, p22);
                        path.CloseFigure();
                    }
                    bottom += 2;
                    PointF p23 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p24 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 1;
                    path.AddLine(p23, p24);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p25 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p26 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p25, p26);
                        path.CloseFigure();
                    }
                    bottom += 2;
                    PointF p27 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p28 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p27, p28);
                    path.CloseFigure();
                    for (int i = 0; i < 5; i++)
                    {
                        PointF p29 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p30 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p29, p30);
                        path.CloseFigure();
                    }
                    bottom += 1;
                    PointF p31 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p32 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    bottom += 2;
                    path.AddLine(p31, p32);
                    for (int i = 0; i < 5; i++)
                    {
                        path.CloseFigure();
                        PointF p33 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i, top - bottom));
                        PointF p34 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + 3 * i + 1, top - bottom));

                        path.AddLine(p33, p34);
                        path.CloseFigure();
                    }
                    bottom += 2;
                    PointF p35 = canvas.ToScreen(new UnitPoint(leftpoint.X + left, top - bottom));
                    PointF p36 = canvas.ToScreen(new UnitPoint(leftpoint.X + left + pailine, top - bottom));
                    path.AddLine(p35, p36);
                    path.CloseFigure();
                    bottom += 20;
                }
                left += 14;
            }
            canvas.Graphics.DrawPath(pen, path);
            Image newImage = Image.FromFile("..//..//Resources//fower.png");



            canvas.Graphics.DrawImage(newImage, 10, 42, 23, 138);
            canvas.Graphics.DrawImage(newImage, 10, 255, 23, 138);
            canvas.Graphics.DrawImage(newImage, 10, 470, 23, 138);
            canvas.Graphics.DrawImage(newImage, 10, 686, 23, 138);
        }