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


C# Line.Draw方法代码示例

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


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

示例1: Main2

    public static int Main2()
    {
        DrawingObject[] dObj = new DrawingObject[4];

        dObj[0] = new Line();
        dObj[1] = new Circle();
        dObj[2] = new Square();
        dObj[3] = new DrawingObject();

        foreach (DrawingObject drawObj in dObj)
        {
            drawObj.Draw();
        }

        Line ttt = new Line();
        ttt.Draw();
        ttt.test();
        DrawingObject tt = new Line();

        tt.Draw();
        tt.test();

        return 0;
    }
开发者ID:clintonm9,项目名称:NBALifeTest,代码行数:24,代码来源:Tutorial.cs

示例2: DrawRectangle

    public static void DrawRectangle(Rectangle rect, long color, bool fill)
    {
      if (fill)
      {
        Rectangle[] rects = new Rectangle[1];
        rects[0] = rect;
        GUIGraphicsContext.DX9Device.Clear(ClearFlags.Target, (int)color, 1.0f, 0, rects);
      }
      else
      {
        Vector2[] vec = new Vector2[2];
        vec[0].X = rect.Left;
        vec[0].Y = rect.Top;
        vec[1].X = rect.Left + rect.Width;
        vec[1].Y = rect.Top;
        using (Line line = new Line(GUIGraphicsContext.DX9Device))
        {
          line.Begin();
          line.Draw(vec, (int)color);

          vec[0].X = rect.Left + rect.Width;
          vec[0].Y = rect.Top;
          vec[1].X = rect.Left + rect.Width;
          vec[1].Y = rect.Top + rect.Height;
          line.Draw(vec, (int)color);

          vec[0].X = rect.Left + rect.Width;
          vec[0].Y = rect.Top + rect.Width;
          vec[1].X = rect.Left;
          vec[1].Y = rect.Top + rect.Height;
          line.Draw(vec, (int)color);


          vec[0].X = rect.Left;
          vec[0].Y = rect.Top + rect.Height;
          vec[1].X = rect.Left;
          vec[1].Y = rect.Top;
          line.Draw(vec, (int)color);
          line.End();
        }
      }
    }
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:42,代码来源:Picture.cs

示例3: DrawLine

 public static void DrawLine(int x1, int y1, int x2, int y2, long color)
 {
   Vector2[] vec = new Vector2[2];
   vec[0].X = x1;
   vec[0].Y = y1;
   vec[1].X = x2;
   vec[1].Y = y2;
   using (Line line = new Line(GUIGraphicsContext.DX9Device))
   {
     line.Begin();
     line.Draw(vec, (int)color);
     line.End();
   }
 }
开发者ID:doskabouter,项目名称:MediaPortal-1,代码行数:14,代码来源:Picture.cs

示例4: DrawNumbersAndLines

		private void DrawNumbersAndLines() {
			//Draw the center line.
			Line centerLine=new Line(device);
			centerLine.Width=1f*TcData.PixelScaleRatio;
			centerLine.Antialias=false;
			centerLine.Begin();//Must call Line.Begin() in order for Antialias=false to take effect.
			centerLine.Draw(new Vector2[] {
				new Vector2(-1,this.Height/2),
				new Vector2(this.Width,this.Height/2)},
				Color.White);
			centerLine.End();
			//Draw the tooth numbers.
			string tooth_id;
			for(int i=1;i<=52;i++) {
				tooth_id=Tooth.FromOrdinal(i);
				if(TcData.SelectedTeeth.Contains(tooth_id)) {
					DrawNumber(tooth_id,true,0);
				} 
				else {
					DrawNumber(tooth_id,false,0);
				}
			}
			//TimeSpan displayTime=(frameEndTime-frameBeginTime);
			//float fps=1000f/displayTime.Milliseconds;
			//this.PrintString(fps.ToString(),0,0,0,Color.Blue,xfont);
		}
开发者ID:mnisl,项目名称:OD,代码行数:26,代码来源:ToothChartDirectX.cs

示例5: DrawAxis

 private void DrawAxis()
 {
     Line y = new Line(gs, new Pen(Brushes.Black, 3), new Point2f(0, -Height / 2), new Point2f(0, Height/2));
     Line x = new Line(gs, new Pen(Brushes.Black, 3), new Point2f(-Width / 2, 0), new Point2f(Width/2, 0));
     y.Draw(1, bmp);
     x.Draw(1, bmp);
 }
开发者ID:TheProjecter,项目名称:somscode,代码行数:7,代码来源:GraphicsBoard.cs

示例6: DrawRectangle

        void DrawRectangle(float x, float y, float w, int h, Line MenuLine, SlimDX.Direct3D9.Font MenuFont, Color4 MenuLineColor)
        {
            try
            {
                SlimDX.Vector2[] vLine1 = new SlimDX.Vector2[2];
                SlimDX.Vector2[] vLine2 = new SlimDX.Vector2[2];
                SlimDX.Vector2[] vLine3 = new SlimDX.Vector2[2];
                SlimDX.Vector2[] vLine4 = new SlimDX.Vector2[2];

                vLine1[0] = new Vector2();
                vLine1[1] = new Vector2();
                vLine2[0] = new Vector2();
                vLine2[1] = new Vector2();
                vLine3[0] = new Vector2();
                vLine3[1] = new Vector2();
                vLine4[0] = new Vector2();
                vLine4[1] = new Vector2();

                vLine1[0].X = x;
                vLine1[0].Y = y;
                vLine1[1].X = x;
                vLine1[1].Y = y + h;

                vLine2[0].X = x + w;
                vLine2[0].Y = y;
                vLine2[1].X = x + w;
                vLine2[1].Y = y + h;

                vLine3[0].X = x;
                vLine3[0].Y = y;
                vLine3[1].X = x + w;
                vLine3[1].Y = y;

                vLine4[0].X = x;
                vLine4[0].Y = y + h;
                vLine4[1].X = x + w;
                vLine4[1].Y = y + h;

                if (MenuLine != null)
                {
                    MenuLine.Width = 2;
                    MenuLine.Antialias = false;
                    MenuLine.GLLines = false;
                    MenuLine.Begin();

                    MenuLine.Draw(vLine1, MenuLineColor);
                    MenuLine.Draw(vLine2, MenuLineColor);
                    MenuLine.Draw(vLine3, MenuLineColor);
                    MenuLine.Draw(vLine4, MenuLineColor);

                    MenuLine.End();
                }
            }
            catch (Exception ExtInfo)
            {
                Interface.ReportException(ExtInfo);
                return;
            }
        }
开发者ID:emist,项目名称:D3DTextureLoggerClient,代码行数:59,代码来源:Main.cs

示例7: DrawLine

        public void DrawLine(float fx, float fy, float tx, float ty, Color color)
        {
            using (Line l = new Line(Devices.D3DDev))
            {
                Vector2[] vects = new Vector2[2];
                vects[0] = new Vector2(fx, fy);
                vects[1] = new Vector2(tx, ty);
                l.Begin();
                l.Draw(vects, color);
                l.End();
            }
            //int w, h;
            //w = Devices.D3DDev.PresentationParameters.BackBufferWidth;
            //h = Devices.D3DDev.PresentationParameters.BackBufferHeight;

            //fx -= w / 2;
            //tx -= w / 2;
            //fy -= h / 2;
            //ty -= h / 2;

            //fy = 0 - fy;
            //ty = 0 - ty;

            //CustomVertex.PositionColored[] verts = new CustomVertex.PositionColored[2];
            //verts[0] = new CustomVertex.PositionColored(fx, fy, 0, color.ToArgb());
            //verts[1] = new CustomVertex.PositionColored(tx, ty, 0, color.ToArgb());

            //Devices.D3DDev.VertexFormat = CustomVertex.PositionColored.Format;
            //Devices.D3DDev.DrawUserPrimitives(PrimitiveType.LineList, 1, verts);

            //vb = new VertexBuffer(typeof(CustomVertex.PositionColored), 2, Devices.D3DDev, Usage.None, CustomVertex.PositionColored.Format, Pool.Managed);
            //vb.SetData(verts, 0, LockFlags.None);
            //Devices.D3DDev.SetStreamSource(0, vb, 0);
            //Devices.D3DDev.DrawPrimitives(PrimitiveType.LineList, 0, 1);
        }
开发者ID:itamargreen,项目名称:metalx,代码行数:35,代码来源:Game.cs


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