• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# Line类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: boardCanvas_MouseDown

        public void boardCanvas_MouseDown(object sender, MouseButtonEventArgs e)
        {
            boardCanvas.CaptureMouse();
            sP = e.GetPosition(boardCanvas);
            newAtr.Color = (Color)colorStroke.SelectedColor;
            newAtr.Height = newAtr.Width = slider.Value;
            boardCanvas.DefaultDrawingAttributes = newAtr;

            if (tempTool == pencilImage.Name || tempTool == eraserImage.Name || tempTool == circleImage.Name || tempTool == rectangleImage.Name)
            {

               if (tempTool == circleImage.Name)
                {
                    ellipse = new Ellipse();
                }
                else if (tempTool == rectangleImage.Name)
                {
                    rect = new Rectangle();
                }
            }
            else if (tempTool == lineImage.Name)
            {
                line_C = new Line();
            }

            else if (tempTool == textBoxImage.Name) {
                tB = new TextBox();
            }

            //eP = new Point(0, 0);
        }
开发者ID:asadnadeem93,项目名称:Collaboard,代码行数:31,代码来源:boardPage.xaml.cs


示例2: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            //int highestPrice = 65;
            //List<int> vals = new List<int>() { 10, 20, 30, 40, 50 };
            //int min = vals.Min();
            //int max = vals.Max();
            //max = highestPrice > max ? highestPrice : max;
            //double range = max - min;
            Color d = new Color() { ScA = 1, ScR = .5F, ScG = .5F, ScB = .5F };
            var line = new Line() { X1 = 0, Y1 = 0, X2 = canvas.Width, Y2 = 0, Stroke = new SolidColorBrush(d), StrokeThickness = 2.0 };
            line = new Line() { X1 = 0, Y1 = 0, X2 = canvas.Width, Y2 = 10, Stroke = new SolidColorBrush(d), StrokeThickness = 1.0 };
            canvas.Children.Add(line);
            line = new Line() { X1 = canvas.Width, Y1 = 10, X2 = 0, Y2 = 20, Stroke = new SolidColorBrush(d), StrokeThickness = 1.0 };
            canvas.Children.Add(line);

            //foreach (int val in vals)
            //{
            //    double percent = 1.0 - ((val - min) / range); // 0 is at the top, so invert it by doing 1.0 - xxx
            //    double y = percent * canvas.Height;
            //    // Draw line in a shade of blue/green
            //    c = new Color() { ScA = 1, ScR = 0, ScG = 0.5f, ScB = (float)percent };
            //    line = new Line() { X1 = 0, Y1 = y, X2 = canvas.Width, Y2 = y, Stroke = new SolidColorBrush(c), StrokeThickness = 2.0 };
            //    canvas.Children.Add(line);
            //}
        }
开发者ID:AdamMartell,项目名称:Projects,代码行数:27,代码来源:MainWindow.xaml.cs


示例3: DrawLineBetween

        /// <summary>
        /// Draw a line between two joints in a canvas
        /// </summary>
        /// <param name="canvas">the canvas</param>
        /// <param name="jstart">the joint where to start the line</param>
        /// <param name="jend">the joint where to end the line</param>
        /// <param name="vskeleton">the visual skeleton</param>
        private static void DrawLineBetween(Canvas canvas, Joint jstart, Joint jend, VisualSkeleton vskeleton)
        {
            if (vskeleton.positionMap.ContainsKey(jstart) && vskeleton.positionMap.ContainsKey(jend))
            {
                Line l = new Line();

                l.X1 = vskeleton.positionMap[jstart].X;
                l.Y1 = vskeleton.positionMap[jstart].Y;
                l.X2 = vskeleton.positionMap[jend].X;
                l.Y2 = vskeleton.positionMap[jend].Y;

                if (jstart.TrackingState == JointTrackingState.Inferred &&
                    jend.TrackingState == JointTrackingState.Inferred)
                {
                    l.Stroke = Brushes.Yellow;
                    l.StrokeThickness = 3;
                }
                else if (jstart.TrackingState == JointTrackingState.Tracked &&
                    jend.TrackingState == JointTrackingState.Tracked)
                {
                    l.Stroke = Brushes.Green;
                    l.StrokeThickness = 3;
                }
                else if (jstart.TrackingState == JointTrackingState.NotTracked ||
                    jend.TrackingState == JointTrackingState.NotTracked)
                {
                    l.Stroke = Brushes.Transparent;
                    l.StrokeThickness = 0;
                }

                canvas.Children.Add(l);
            }
        }
开发者ID:HaKDMoDz,项目名称:kinectQlikView,代码行数:40,代码来源:VisualSkeleton.cs


示例4: Log

        /// <summary>
        /// Add line to Log
        /// </summary>
        /// <param name="text"></param>
        /// <param name="file"></param>
        /// <param name="member"></param>
        /// <param name="lineNumber"></param>
        public static void Log(string text, LogLineType type = LogLineType.Notification, [CallerFilePath] string filename = "", [CallerMemberName] string member = "", [CallerLineNumber] int lineNumber = 0)
        {
            try
            {
                string[] lines = text.Split(new string[] { "\r\n", "\n", Environment.NewLine }, StringSplitOptions.None);
                foreach (var line in lines)
                {
                    var queueLine = new Line();
                    queueLine.Text = line;
                    queueLine.Type = type;
                    queueLine.Timestamp = DateTime.Now;

                    var assembly = Assembly.GetCallingAssembly();

                    queueLine.Assembly = assembly.FullName;
                    queueLine.Filename = filename;
                    queueLine.Member = member;
                    queueLine.LineNumber = lineNumber;

                    logQueue.AddLineToQueue(queueLine);
                    Console.WriteLine(line);
                }
            }
            catch (Exception ex) { }
        }
开发者ID:TrakHound,项目名称:TrakHound-Community,代码行数:32,代码来源:Logger.cs


示例5: Setup

        public void Setup()
        {
            m_StartPoint = new Point(-10.0,
                                     -10.0);
            m_EndPoint = new Point(10.0,
                                   10.0);
            m_LineDirection = Constants.LineDirection.Forward;

            m_Line = new Line(m_StartPoint,
                              m_EndPoint);

            m_WindowsStartPoint = new System.Windows.Point(100.0,
                                                           200.0);
            m_WindowsEndPoint = new System.Windows.Point(300.0,
                                                         400.0);

            m_GeometryPointToWindowsPointConverter = Substitute.For <IGeometryPointToWindowsPointConverter>();
            m_GeometryPointToWindowsPointConverter.Point.Returns(m_WindowsStartPoint,
                                                                 m_WindowsEndPoint);

            m_Sut = new LineToWindowPointsConverter(m_GeometryPointToWindowsPointConverter)
                    {
                        Line = m_Line
                    };
            m_Sut.Line = m_Line;
            m_Sut.LineDirection = m_LineDirection;
            m_Sut.Convert();
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:28,代码来源:LineToWindowPointsConverterTests.cs


示例6: OnPart

		public void OnPart(Line line)
		{
			line.GetChannel().Users.Remove(line.Prefix.Nickname);

			if (line.PrefixIsSelf())
				Channels.Remove(line.Target);
		}
开发者ID:JackKucan,项目名称:OpenRA,代码行数:7,代码来源:IrcClientUser.cs


示例7: SqlCommandWithValues

 internal static SqlCommand SqlCommandWithValues(SqlCommand sqlCommand, Line line) {
     var values = line.Values.ToArray();
     for (var i = 0; i < values.Length; i++) {
         sqlCommand.Parameters[i].Value = values[i];
     }
     return sqlCommand;
 }
开发者ID:slieser,项目名称:sandbox,代码行数:7,代码来源:DbAdapter.cs


示例8: Setup

        public void Setup()
        {
            m_FromStartPoint = new Point(10.0,
                                         10.0);
            m_FromEndPoint = new Point(60.0,
                                       60.0);
            m_ToStartPoint = new Point(-10.0,
                                       -10.0);
            m_ToEndPoint = new Point(-60.0,
                                     -60.0);

            m_From = new Line(0,
                              m_FromStartPoint,
                              m_FromEndPoint);
            m_FromDirection = Constants.LineDirection.Forward;
            m_To = new Line(1,
                            m_ToStartPoint,
                            m_ToEndPoint);
            m_ToDirection = Constants.LineDirection.Forward;

            m_Sut = new LinesToTransferPointsConverter(m_From,
                                                       m_FromDirection,
                                                       m_To,
                                                       m_ToDirection);

            m_Sut.Convert();
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:27,代码来源:LinesToTransferPointsConverterTests.cs


示例9: Intersect

 // Static function to find the intersection of two planes
 // If they are parallel, returns false and outputs an invalid line struct
 // Otherwise, returns true and outputs the line of intersection
 public static bool Intersect(Plane a, Plane b, out Line result)
 {
     Vec3 cross = Vec3.Cross(a.normal, b.normal);
     double magsq = cross.ComputeMagnitudeSquared();
     if (magsq == 0)
     {
         // failure! planes did not intersect, or planes were equal
         result = new Line { direction = Vec3.Zero, origin = Vec3.Zero };                // not a valid line!
         return false;
     }
     double invmag = 1.0 / Math.Sqrt(magsq);
     Vec3 line_direction = cross * invmag;
     // using plane a to find intersection (also could try b?)
     Vec3 in_a_toward_edge = Vec3.Normalize(Vec3.Cross(a.normal, line_direction));
     Vec3 point_in_a = a.normal * a.offset;
     double dist = b.PointDistance(point_in_a);
     // seems this number could be either the positive or negative of what we want...
     double unsigned_r = dist * invmag;
     Vec3 positive = point_in_a + in_a_toward_edge * unsigned_r;
     Vec3 negative = point_in_a - in_a_toward_edge * unsigned_r;
     // figure out which one is actually at the intersection (or closest to it)
     double positive_check = new Vec2 { x = a.PointDistance(positive), y = b.PointDistance(positive) }.ComputeMagnitudeSquared();
     double negative_check = new Vec2 { x = a.PointDistance(negative), y = b.PointDistance(negative) }.ComputeMagnitudeSquared();
     // and use that one as a point on the line (for the out value)
     Vec3 point_on_line;
     if (positive_check < negative_check)
         point_on_line = positive;
     else
         point_on_line = negative;
     // success! planes intersectedx
     result = new Line { origin = point_on_line, direction = line_direction };
     return true;
 }
开发者ID:aravindm90,项目名称:modelthulhu,代码行数:36,代码来源:Plane.cs


示例10: Cross

 internal static Vector Cross(Line line1, Line line2)
 {
     if (line2.K - line1.K == 0) return new Vector(0, line1.B);
     var x = (line1.B - line2.B) / (line2.K - line1.K);
     var y = line1.K * x + line1.B;
     return new Vector(x, y);
 }
开发者ID:yojig,项目名称:CloudBall,代码行数:7,代码来源:Line.cs


示例11: Normal

 internal static Line Normal(Line line, Vector point)
 {
     if (line.K == 0) return new Line(0, 0);
     var kn = Math.Round(-1f / line.K, 1);
     var bn = Math.Round(point.Y - kn * point.X, 1);
     return new Line(kn, bn);
 }
开发者ID:yojig,项目名称:CloudBall,代码行数:7,代码来源:Line.cs


示例12: Setup

        public void Setup()
        {
            m_Line1 = new Line(0, 10.0, 10.0, 20.0, 10.0);
            m_Line2 = new Line(1, 10.0, 20.0, 20.0, 20.0);

            m_Lines1 = new[] {m_Line1, m_Line2};
            m_Lines2 = new[] {m_Line2, m_Line1};

            m_ForwardForwardPaths = CreateForwardForwardPaths();
            m_ForwardReversePaths = CreateForwardReversePaths();
            m_ReverseForwardPaths = CreateReverseForwardPaths();
            m_ReverseReversePaths = CreateReverseReversePaths();

            m_Racetracks = Substitute.For<IRacetracks>();
            m_Racetracks.ForwardToForward.Returns(m_ForwardForwardPaths);
            m_Racetracks.ForwardToReverse.Returns(m_ForwardReversePaths);
            m_Racetracks.ReverseToForward.Returns(m_ReverseForwardPaths);
            m_Racetracks.ReverseToReverse.Returns(m_ReverseReversePaths);

            m_Converter = new LineToLinesConverter(new CostStartToStartCalculator(),
                                                   new CostStartToEndCalculator(),
                                                   new CostEndToStartCalculator(),
                                                   new CostEndToEndCalculator())
                          {
                              Racetracks = m_Racetracks,
                              Line = m_Line1,
                              Lines = m_Lines1
                          };

            m_Converter.Convert();
        }
开发者ID:tschroedter,项目名称:Selkie.WPF,代码行数:31,代码来源:LineToLinesConverterTests.cs


示例13: Move

        public override void Move()
        {
            if (x + 2 < Console.WindowHeight && isGoingDown)
            {
                Console.SetCursorPosition(0, x);
                foreach (var dot in LineTypes.AllLines[x].Dots)
                {
                    dot.Content = Dot.ContentToString(Strings.emptyString);
                }
                LineTypes.AllLines[x].Draw();
                x++;
                this.ruler = LineTypes.AllLines[x];
            }
            else
            {
                isGoingDown = false;
            }

            if (x > 0 && !isGoingDown)
            {
                Console.SetCursorPosition(0, x);
                foreach (var dot in LineTypes.AllLines[x].Dots)
                {
                    dot.Content = Dot.ContentToString(Strings.emptyString);
                }
                LineTypes.AllLines[x].Draw();
                x--;
                this.ruler = LineTypes.AllLines[x];
            }
            else
            {
                isGoingDown = true;
            }
        }
开发者ID:viraldim,项目名称:ConsoleDarts,代码行数:34,代码来源:HorizontalMovement.cs


示例14: Exec

 async Task Exec(string cmd, double param)
 {
     var px = x; var py = y;
     switch(cmd)
     {
         case "forw":
             x += param * Math.Sin(Conv(angle));
             y += param * Math.Cos(Conv(angle));
             await Speak("Going forward");
             break;
         case "back":
             x -= param * Math.Sin(Conv(angle));
             y -= param * Math.Cos(Conv(angle));
             await Speak("Going Back");
             break;
         case "left":
             angle += param;
             await Speak("Turning left");
             break;
         case "right":
             angle -= param;
             await Speak("Turning right");
             break;
     }
     if (px!=x || py!=y)
     {
         var P = new Line();
         P.X1 = px; P.Y1 = py;
         P.X2 = x; P.Y2 = y;
         P.Stroke = new SolidColorBrush(Colors.Black);
         P.StrokeThickness = 1;
         main.Children.Add(P);
     }
     SetTurtle();
 }
开发者ID:GoreMaria,项目名称:VoiceDraw,代码行数:35,代码来源:MainPage.xaml.cs


示例15: GetGraphics

        public override GraphicsResult GetGraphics(IWpfTextView view, Geometry geometry)
        {
            Initialize(view);

            // We clip off a bit off the start of the line to prevent a half-square being
            // drawn.
            var clipRectangle = geometry.Bounds;
            clipRectangle.Offset(2, 0);

            var line = new Line
            {
                X1 = geometry.Bounds.Left,
                Y1 = geometry.Bounds.Bottom - _graphicsTagPen.Thickness,
                X2 = geometry.Bounds.Right,
                Y2 = geometry.Bounds.Bottom - _graphicsTagPen.Thickness,
                Clip = new RectangleGeometry { Rect = clipRectangle }
            };
            // RenderOptions.SetEdgeMode(line, EdgeMode.Aliased);

            ApplyPen(line, _graphicsTagPen);

            // Shift the line over to offset the clipping we did.
            line.RenderTransform = new TranslateTransform(-_graphicsTagPen.Thickness, 0);
            return new GraphicsResult(line, null);
        }
开发者ID:TyOverby,项目名称:roslyn,代码行数:25,代码来源:SuggestionTag.cs


示例16: AddPoint

    //-----------------------------------------------------
    public void AddPoint(Vector2 newPoint)
    {
        if(!m_lineStarted)
        {
            m_tmpLine = new Line();
            m_tmpLine.src = newPoint;
            m_lineStarted = true;
        }
        else
        {
            m_tmpLine.setDst(newPoint, s_lineDrawWidth);

            Vector2 pxSrc = ToPixelCoord(m_tmpLine.src);
            Vector2 pxDst = ToPixelCoord(m_tmpLine.dst);
            float pixelLen = (pxDst - pxSrc).magnitude;

            if(pixelLen > 3/*10*/)
            {
                m_lines.Add(m_tmpLine);
                m_tmpLine = new Line();
                m_tmpLine.src = newPoint;
                m_lineStarted  = true;
            }
        }
    }
开发者ID:gviaud,项目名称:OS-unity-5,代码行数:26,代码来源:Ev2_Polygon.cs


示例17: InsertNewLineGlyph

 public LineGlyph InsertNewLineGlyph(Line line)
 {
     var lineGlyph = new LineGlyph(line)
                         {Config = ParentVectorRedactor.LineConfig, Parent = this, MainGlyph = MainGlyph};
     InsertChild(lineGlyph);
     return lineGlyph;
 }
开发者ID:ernado,项目名称:Owl,代码行数:7,代码来源:Glyphs.cs


示例18: Main

        static void Main(string[] args)
        {
            Drawing obj = new Line();
            obj.Draw();

            Console.ReadKey();
        }
开发者ID:CavadJava,项目名称:C-sharp--OOP,代码行数:7,代码来源:Program.cs


示例19: OnTick

        public override void OnTick()
        {
            if (!Manager.IsInGame)
                return;

            var greenCircle = new Circle(CIRCLE_RADIUS, Color.FromArgb(0x8f, 0, 0xff, 0), Color.FromArgb(0x8f, 0, 0xff, 0));
            var redCircle = new Circle(CIRCLE_RADIUS, Color.FromArgb(0x8f, 0xff, 0, 0), Color.FromArgb(0x8f, 0xff, 0, 0));
            var blueCircle = new Circle(CIRCLE_RADIUS, Color.Black, Color.FromArgb(0x8f, 0, 0, 0xff), isFilled: false);

            var units = Manager.Objects.Where(x => x.IsValid && (x.IsUnit || x.IsPlayer)).OfType<WoWUnit>();
            foreach (var u in units)
            {
                if (u.IsNeutral || u.IsHostile)
                    redCircle.Add(u.Location.ToVector3());
                else
                    greenCircle.Add(u.Location.ToVector3());

                blueCircle.Add(u.Location.ToVector3());

                var color = (u.InLoS ? Color.FromArgb(0x8f, 0, 0xff, 0) : Color.FromArgb(0x8f, 0xff, 0, 0));
                var line = new Line();
                line.Add(Manager.LocalPlayer.Location, color);
                line.Add(u.Location, color);
                Rendering.RegisterResource(line);
            }

            Rendering.RegisterResource(redCircle);
            Rendering.RegisterResource(greenCircle);
            Rendering.RegisterResource(blueCircle);
        }
开发者ID:alex-v-odesk,项目名称:IceFlake,代码行数:30,代码来源:DrawingScript.cs


示例20: ToWorldFrom

 public Line ToWorldFrom(Transform t)
 {
     Line ret = new Line();
     ret.from = t.TransformPoint(from);
     ret.to = ret.from + t.TransformDirection(to - from);
     return ret;
 }
开发者ID:IlyaBokovenko,项目名称:spear-fishing,代码行数:7,代码来源:FishObstacleAvoidingBehaviour.cs



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# LineCap类代码示例发布时间:2022-05-24
下一篇:
C# LimitState类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap