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


C# Line.bind方法代码示例

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


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

示例1: Handle

        public Handle(Anchor a, bool left)
        {
            anchor = a;
            Left = left;
            Slope = Left ? a.point.Value.ArriveTangent : a.point.Value.LeaveTangent;
            Line line = new Line();
            line.bind(Line.X1Property, a, "X");
            line.bind(Line.Y1Property, a, "Y", new YConverter(), a.graph.ActualHeight);
            line.bind(Line.X2Property, this, "X");
            line.bind(Line.Y2Property, this, "Y", new YConverter(), a.graph.ActualHeight);
            line.bind(VisibilityProperty, this, "Visibility");
            line.Style = a.graph.FindResource("HandleLine") as Style;
            a.graph.graph.Children.Add(line); 
            this.DragDelta += OnDragDelta;

            double hScale = a.graph.HorizontalScale;
            double vScale = a.graph.VerticalScale;
            double xLength = (HANDLE_LENGTH * (Left ? -1 : 1)) / Math.Sqrt(Math.Pow(hScale, 2) + Math.Pow(Slope, 2) * Math.Pow(vScale, 2));
            X = xLength * hScale + a.X;
            Y = Slope * xLength * vScale + a.Y;
        }
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:21,代码来源:Handle.cs

示例2: PathBetween

 private void PathBetween(Anchor a1, Anchor a2, CurveMode interpMode = CurveMode.CIM_Linear)
 {
     Line line;
     BezierSegment bez;
     switch (interpMode)
     {
         case CurveMode.CIM_Linear:
             line = new Line();
             line.bind(Line.X1Property, a1, "X");
             line.bind(Line.Y1Property, a1, "Y", new YConverter(), ActualHeight);
             line.bind(Line.X2Property, a2, "X");
             line.bind(Line.Y2Property, a2, "Y", new YConverter(), ActualHeight);
             graph.Children.Add(line);
             break;
         case CurveMode.CIM_Constant:
             line = new Line();
             line.bind(Line.X1Property, a1, "X");
             line.bind(Line.Y1Property, a1, "Y", new YConverter(), ActualHeight);
             line.bind(Line.X2Property, a2, "X");
             line.bind(Line.Y2Property, a1, "Y", new YConverter(), ActualHeight);
             graph.Children.Add(line);
             line = new Line();
             line.bind(Line.X1Property, a2, "X");
             line.bind(Line.Y1Property, a1, "Y", new YConverter(), ActualHeight);
             line.bind(Line.X2Property, a2, "X");
             line.bind(Line.Y2Property, a2, "Y", new YConverter(), ActualHeight);
             graph.Children.Add(line);
             break;
         case CurveMode.CIM_CurveAuto:
         case CurveMode.CIM_CurveUser:
         case CurveMode.CIM_CurveBreak:
         case CurveMode.CIM_CurveAutoClamped:
             bez = new BezierSegment(this);
             bez.Slope1 = a1.point.Value.LeaveTangent;
             bez.Slope2 = a2.point.Value.ArriveTangent;
             bez.bind(BezierSegment.X1Property, a1, "X");
             bez.bind(BezierSegment.Y1Property, a1, "Y");
             bez.bind(BezierSegment.X2Property, a2, "X");
             bez.bind(BezierSegment.Y2Property, a2, "Y");
             graph.Children.Add(bez);
             a1.rightBez = bez;
             a2.leftBez = bez;
             break;
         default:
             break;
     }
 }
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:47,代码来源:CurveGraph.xaml.cs

示例3: Paint


//.........这里部分代码省略.........
                    vSpan += 1;
                }
                VerticalScale = graph.ActualHeight / vSpan;
            }

            int numXLines = Convert.ToInt32(Math.Ceiling(ActualWidth / LINE_SPACING));
            int numYLines = Convert.ToInt32(Math.Ceiling(ActualHeight / LINE_SPACING));
            double upperXBound = unrealX(ActualWidth);
            double upperYBound = unrealY(ActualHeight);
            double lineXSpacing = (upperXBound - HorizontalOffset) / numXLines;
            int xGranularity = lineXSpacing > 0.75 ? 1 : (lineXSpacing > 0.25 ? 2 : 10);
            lineXSpacing = Math.Ceiling(lineXSpacing * xGranularity) / xGranularity;
            double lineYSpacing = (upperYBound - VerticalOffset) / numYLines;
            int yGranularity = lineYSpacing > 0.75 ? 1 : (lineYSpacing > 0.25 ? 2 : 10);
            lineYSpacing = Math.Ceiling(lineYSpacing * yGranularity) / yGranularity;

            Line line;
            Label label;
            double linepos;
            for (int i = 0; i < numXLines; i++)
            {
                linepos = HorizontalOffset + (lineXSpacing * (i + 1));
                line = new Line();
                Canvas.SetLeft(line, localX(linepos));
                line.Style = FindResource("VerticalLine") as Style;
                graph.Children.Add(line);

                label = new Label();
                Canvas.SetLeft(label, localX(linepos));
                Canvas.SetBottom(label, 0);
                label.Content = linepos.ToString("0.00");
                graph.Children.Add(label);
            }

            for (int i = 0; i < numYLines; i++)
            {
                linepos = VerticalOffset + (lineYSpacing * (i + 1));
                line = new Line();
                Canvas.SetBottom(line, localY(linepos));
                line.Style = FindResource("HorizontalLine") as Style;
                graph.Children.Add(line);

                label = new Label();
                Canvas.SetBottom(label, localY(linepos));
                label.Content = linepos.ToString("0.00");
                graph.Children.Add(label);
            }

            Anchor lastAnchor = null;
            for (LinkedListNode<CurvePoint> node = points.First; node != null; node = node.Next)
            {
                switch (node.Value.InterpMode)
                {
                    case CurveMode.CIM_CurveAuto:
                    case CurveMode.CIM_CurveUser:
                        node.Value.LeaveTangent = node.Value.ArriveTangent;
                        break;
                    case CurveMode.CIM_CurveAutoClamped:
                        node.Value.ArriveTangent = node.Value.LeaveTangent = 0f;
                        break;
                    case CurveMode.CIM_CurveBreak:
                    case CurveMode.CIM_Constant:
                    case CurveMode.CIM_Linear:
                    default:
                        break;
                }

                Anchor a = new Anchor(this, node);
                if (node.Value == SelectedPoint)
                {
                    a.IsSelected = true;
                }
                graph.Children.Add(a);

                if (node.Previous == null)
                {
                    line = new Line();
                    line.X1 = -10;
                    line.bind(Line.Y1Property, a, "Y", new YConverter(), ActualHeight);
                    line.bind(Line.X2Property, a, "X");
                    line.bind(Line.Y2Property, a, "Y", new YConverter(), ActualHeight);
                    graph.Children.Add(line);
                }
                else
                {
                    PathBetween(lastAnchor, a, node.Previous.Value.InterpMode);
                }

                if (node.Next == null)
                {
                    line = new Line();
                    line.bind(Line.X1Property, a, "X");
                    line.bind(Line.Y1Property, a, "Y", new YConverter(), ActualHeight);
                    line.X2 = ActualWidth + 10;
                    line.bind(Line.Y2Property, a, "Y", new YConverter(), ActualHeight);
                    graph.Children.Add(line);
                }
                lastAnchor = a;
            }
        }
开发者ID:ME3Explorer,项目名称:ME3Explorer,代码行数:101,代码来源:CurveGraph.xaml.cs


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