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


C# ICanvas.ToScreen方法代码示例

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


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

示例1: Draw

 public override void Draw(ICanvas canvas, RectangleF unitrect)
 {
     Color color = Color;
     Brush B = Brushes.Black;
     Pen pen = canvas.CreatePen(color, Width);
     if (Highlighted || Selected)
     {
         pen = Canvas.DrawTools.DrawUtils.SelectedPen;
         B = Brushes.Magenta;
     }
     pen = new Pen(pen.Color, (float)6);
     canvas.DrawArc(canvas, pen, m_p1, (float)0.03, 0, 360);
     float size = (canvas.ToScreen(new UnitPoint(m_p1.X + 1, m_p1.Y)).X - canvas.ToScreen(m_p1).X) / 10;
     Font m_font = new System.Drawing.Font("Arial Black", size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
     canvas.Graphics.DrawString("Tp Line Conductor", m_font, B, canvas.ToScreen(new UnitPoint(m_p1.X - 0.4, m_p1.Y + 0.2)).X, canvas.ToScreen(new UnitPoint(m_p1.X - 0.3, m_p1.Y + 0.2)).Y);
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:16,代码来源:TriplexLineConductor.cs

示例2: DrawNode

 static public void DrawNode(ICanvas canvas, UnitPoint nodepoint)
 {
     RectangleF r = new RectangleF(canvas.ToScreen(nodepoint), new SizeF(0, 0));
     r.Inflate(3, 3);
     if (r.Right < 0 || r.Left > canvas.ClientRectangle.Width)
         return;
     if (r.Top < 0 || r.Bottom > canvas.ClientRectangle.Height)
         return;
     canvas.Graphics.FillRectangle(Brushes.White, r);
     r.Inflate(1, 1);
     canvas.Graphics.DrawRectangle(Pens.Black, ScreenUtils.ConvertRect(r));
 }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:12,代码来源:DrawToolsUtils.cs

示例3: DrawTriangleNode

        static public void DrawTriangleNode(ICanvas canvas, UnitPoint nodepoint)
        {
            PointF screenpoint = canvas.ToScreen(nodepoint);
            float size = 4;
            PointF[] p = new PointF[] 
			{
				new PointF(screenpoint.X - size, screenpoint.Y),
				new PointF(screenpoint.X, screenpoint.Y + size),
				new PointF(screenpoint.X + size, screenpoint.Y),
				new PointF(screenpoint.X, screenpoint.Y - size),
			};
            canvas.Graphics.FillPolygon(Brushes.White, p);
        }
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:13,代码来源:DrawToolsUtils.cs

示例4: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                //if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
            }
            pen = new Pen(pen.Color, (float)6);

            canvas.DrawArc(canvas,pen,m_p1,(float)0.05,0,360);
            pen = new Pen(pen.Color, (float)3);
            canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p1.X - 0.2, m_p1.Y - 0.2)).X, canvas.ToScreen(new UnitPoint(m_p1.X + 0.2, m_p1.Y + 0.2)).Y, canvas.ToScreen(new UnitPoint(m_p1.X + 0.2, m_p1.Y +0.2)).X - canvas.ToScreen(new UnitPoint(m_p1.X - 0.2, m_p1.Y - 0.2)).X, canvas.ToScreen(new UnitPoint(m_p1.X - 0.2, m_p1.Y - 0.2)).Y - canvas.ToScreen(new UnitPoint(m_p1.X + 0.2, m_p1.Y + 0.2)).Y);
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:15,代码来源:Meter.cs

示例5: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
                if (m_p2.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p2);
                //if ((m_p3.X != m_p2.X + 1 || m_p3.Y != m_p2.Y) && this.horizontal) m_p3 = new UnitPoint(m_p2.X + 1, m_p2.Y);
                //if (m_p3.Y != m_p2.Y + 1 && !this.horizontal) m_p3 = new UnitPoint(m_p2.X, m_p2.Y + 1);
                if (m_p3.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p3);
            }
            canvas.DrawLine(canvas, pen, m_p1, m_p2);
            pen = new Pen(pen.Color, (float)3);
            if (horizontal)
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X+0.8,m_p2.Y));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.4)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.8, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, m_p2.Y + 0.2)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.4)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y +0.4)).Y);
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y + 0.3), new UnitPoint(m_p2.X + 0.8, m_p2.Y + 0.3));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y + 0.2), new UnitPoint(m_p2.X + 0.8, m_p2.Y + 0.2));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y + 0.1), new UnitPoint(m_p2.X + 0.8, m_p2.Y + 0.1));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y - 0.3), new UnitPoint(m_p2.X + 0.8, m_p2.Y - 0.3));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y - 0.2), new UnitPoint(m_p2.X + 0.8, m_p2.Y - 0.2));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y - 0.1), new UnitPoint(m_p2.X + 0.8, m_p2.Y - 0.1));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.3, m_p2.Y + 0.4), new UnitPoint(m_p2.X + 0.3, m_p2.Y - 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y + 0.4), new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.5, m_p2.Y + 0.4), new UnitPoint(m_p2.X + 0.5, m_p2.Y - 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.6, m_p2.Y + 0.4), new UnitPoint(m_p2.X + 0.6, m_p2.Y - 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.7, m_p2.Y + 0.4), new UnitPoint(m_p2.X + 0.7, m_p2.Y - 0.4));

            }
            else
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X, m_p2.Y-0.8));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.4, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.8)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y);
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.3, m_p2.Y - 0.2), new UnitPoint(m_p2.X + 0.3, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.2, m_p2.Y - 0.2), new UnitPoint(m_p2.X + 0.2, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.1, m_p2.Y - 0.2), new UnitPoint(m_p2.X + 0.1, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X -0.3, m_p2.Y -0.2), new UnitPoint(m_p2.X - 0.3, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X -0.2, m_p2.Y -0.2), new UnitPoint(m_p2.X - 0.2, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X -0.1, m_p2.Y -0.2), new UnitPoint(m_p2.X - 0.1, m_p2.Y - 0.8));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.3), new UnitPoint(m_p2.X - 0.4, m_p2.Y - 0.3));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.4), new UnitPoint(m_p2.X - 0.4, m_p2.Y - 0.4));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.5), new UnitPoint(m_p2.X - 0.4, m_p2.Y - 0.5));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.6), new UnitPoint(m_p2.X - 0.4, m_p2.Y - 0.6));
                canvas.DrawLine(canvas, pen, new UnitPoint(m_p2.X + 0.4, m_p2.Y - 0.7), new UnitPoint(m_p2.X - 0.4, m_p2.Y - 0.7));
            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:49,代码来源:SolarPanel.cs

示例6: ToScreen

 public static RectangleF ToScreen(ICanvas canvas, RectangleF unitrect)
 {
     RectangleF r = new RectangleF();
     r.Location = canvas.ToScreen(new UnitPoint(unitrect.Location));
     r.Width = (float)Math.Round(canvas.ToScreen(unitrect.Width));
     r.Height = (float)Math.Round(canvas.ToScreen(unitrect.Height));
     return r;
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:8,代码来源:Utils.cs

示例7: DrawObjects

 public void DrawObjects(ICanvas canvas, RectangleF r)
 {
     if (m_copies.Count == 0)
         return;
     canvas.Graphics.DrawLine(Pens.Wheat, canvas.ToScreen(OriginPoint), canvas.ToScreen(LastPoint));
     foreach (IDrawObject obj in Copies)
         obj.Draw(canvas, r);
 }
开发者ID:jjacksons,项目名称:GLUE,代码行数:8,代码来源:Utils.cs

示例8: Draw

        public void Draw(ICanvas canvas, RectangleF unitrect)
        {
            if (Enabled == false)
                return;
            float gridX = Spacing.Width;
            float gridY = Spacing.Height;
            float gridscreensizeX = canvas.ToScreen(gridX);
            float gridscreensizeY = canvas.ToScreen(gridY);
            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;

            if (GridStyle == eStyle.Dots)
            {
                GDI gdi = new GDI();
                gdi.BeginGDI(canvas.Graphics);
                for (float x = left; x <= right; x += gridX)
                {
                    for (float y = bottom; y <= top; y += gridY)
                    {
                        PointF p1 = canvas.ToScreen(new UnitPoint(x, y));
                        gdi.SetPixel((int)p1.X, (int)p1.Y, m_color.ToArgb());
                    }
                }
                gdi.EndGDI();
            }
            if (GridStyle == eStyle.Lines)
            {
                Pen pen = new Pen(m_color);
                GraphicsPath path = new GraphicsPath();

                // draw vertical lines
                while (left < right)
                {
                    PointF p1 = canvas.ToScreen(new UnitPoint(left, leftpoint.Y));
                    PointF p2 = canvas.ToScreen(new UnitPoint(left, rightpoint.Y));
                    path.AddLine(p1, p2);
                    path.CloseFigure();
                    left += gridX;
                }

                // draw horizontal lines
                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;
                }
                canvas.Graphics.DrawPath(pen, path);
            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:60,代码来源:GridLayer.cs

示例9: Draw

        public override void Draw(ICanvas canvas, RectangleF unitrect)
        {
            Color color = Color;
            Brush B = Brushes.Black;
            Pen pen = canvas.CreatePen(color, Width);
            if (Highlighted || Selected)
            {
                pen = Canvas.DrawTools.DrawUtils.SelectedPen;
                if (m_p1.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p1);
                if (m_p2.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p2);
                if (m_p3.IsEmpty == false) Canvas.DrawTools.DrawUtils.DrawNode(canvas, m_p3);
                B = Brushes.Magenta;
            }
            canvas.DrawLine(canvas, pen, m_p1, m_p2);
            pen = new Pen(pen.Color, (float)3);
            if (horizontal)
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X + 0.2, m_p2.Y));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.1)).Y, canvas.ToScreen(m_p3).X - canvas.ToScreen(new UnitPoint(m_p2.X + 0.2, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.1)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y + 0.1)).Y);
                float size = (canvas.ToScreen(new UnitPoint(m_p1.X + 1, m_p1.Y)).X - canvas.ToScreen(m_p1).X) / 10;
                Font m_font = new System.Drawing.Font("Arial Black", size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                canvas.Graphics.DrawString("Recorder", m_font, B, canvas.ToScreen(new UnitPoint(m_p2.X + 0.25, m_p2.Y - 0.1)).X, canvas.ToScreen(new UnitPoint(m_p2.X - 0.3, m_p2.Y + 0.1)).Y);

            }
            else
            {
                canvas.DrawLine(canvas, pen, m_p2, new UnitPoint(m_p2.X, m_p2.Y - 0.2));
                canvas.Graphics.DrawRectangle(pen, canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y, canvas.ToScreen(new UnitPoint(m_p2.X + 0.4, 1)).X - canvas.ToScreen(new UnitPoint(m_p2.X - 0.4, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.4)).Y - canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y);
                float size = (canvas.ToScreen(new UnitPoint(m_p1.X + 1, m_p1.Y)).X - canvas.ToScreen(m_p1).X) / 10;
                Font m_font = new System.Drawing.Font("Arial Black", size, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
                canvas.Graphics.DrawString("Recorder", m_font, B, canvas.ToScreen(new UnitPoint(m_p2.X - 0.35, 1)).X, canvas.ToScreen(new UnitPoint(1, m_p2.Y - 0.2)).Y);
            }
        }
开发者ID:jjacksons,项目名称:GLUE,代码行数:33,代码来源:Recorder.cs

示例10: Draw

        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);
//.........这里部分代码省略.........
开发者ID:sduxiaowu,项目名称:NineLineScore,代码行数:101,代码来源:GridLayer.cs


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