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


C# Line.SetValue方法代码示例

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


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

示例1: CreateContactsBetweenTwoFloors

        //每一层级间的端口线段连接
        public void CreateContactsBetweenTwoFloors(int[] tag,int n, int floors)
        {
            for (int j = 0; j < n; j++)
            {
                Line line = new Line();
                line.Stroke = new SolidColorBrush(Colors.Black);
                line.SetValue(Canvas.TopProperty, (double)rectangles_list[j / 2][floors].GetValue(Canvas.TopProperty));
                line.SetValue(Canvas.LeftProperty, (double)rectangles_list[j / 2][floors].GetValue(Canvas.LeftProperty));
                line.X1 = rectangles_list[j / 2][floors].Width;
                line.Y1 = ((j % 2 == 0) ? (rectangles_list[j / 2][floors].Height / 6) : (5 * rectangles_list[j / 2][floors].Height / 6));

                //下一层
                line.X2 = (double)rectangles_list[tag[j] / 2][floors + 1].GetValue(Canvas.LeftProperty)
                    - (double)rectangles_list[j / 2][floors].GetValue(Canvas.LeftProperty);

                line.Y2 = (double)rectangles_list[tag[j] / 2][floors + 1].GetValue(Canvas.TopProperty)
                    - (double)rectangles_list[j / 2][floors].GetValue(Canvas.TopProperty)
                    + ((tag[j] % 2 == 0) ? (rectangles_list[tag[j] / 2][floors + 1].Height / 6) : (5 * rectangles_list[tag[j] / 2][floors + 1].Height / 6));

                MainWindow.mainwindow.canvas.Children.Add(line);
            }
        }
开发者ID:ForeverSc,项目名称:NewIOTSystem,代码行数:23,代码来源:CreateView.cs

示例2: MousePicker

        public MousePicker(PhysicsSimulator physicsSimulator, Canvas canvas)
        {
            _canvas = canvas;
            _physicsSimulator = physicsSimulator;

            _canvas.MouseLeftButtonDown += MouseLeftButtonDown;
            _canvas.MouseLeftButtonUp += MouseLeftButtonUp;
            _canvas.MouseMove += MouseMove;

            _mousePickLine = new Line();
            _mousePickLine.Stroke = new SolidColorBrush(Color.FromArgb(150, 0, 0, 0));
            _mousePickLine.Visibility = Visibility.Collapsed;
            _mousePickLine.SetValue(Canvas.ZIndexProperty, 1000);
            _canvas.Children.Add(_mousePickLine);
        }
开发者ID:rbrother,项目名称:seikkailulaakso,代码行数:15,代码来源:MousePicker.cs

示例3: SilverlightVertice

        public SilverlightVertice(Point p1,Point p2)
        {
            Line = new Line();
            Line.SetValue(Canvas.ZIndexProperty, 0);
            Line.Stroke = new SolidColorBrush() { Color = Color.FromArgb((byte)255, (byte)0, (byte)0, (byte)255) };

            Line.Tag = this;

            Line.X1 = p1.X + 10;
            Line.Y1 = p1.Y + 10;

            Line.X2 = p2.X + 10;
            Line.Y2 = p2.Y + 10;

            Line.StrokeThickness = 2;
        }
开发者ID:framirezh,项目名称:GraphMaker---Multiple-Traveling-Salesman,代码行数:16,代码来源:SilverlightVertice.cs

示例4: SetRectanglesStatus

        //设置直通和交换的rectangle中的不同显示
        public void SetRectanglesStatus(int flag, Rectangle rect)
        {
            Line line1 = new Line();
            line1.Stroke = new SolidColorBrush(Colors.Black);
            line1.SetValue(Canvas.TopProperty, (double)rect.GetValue(Canvas.TopProperty));
            line1.SetValue(Canvas.LeftProperty, (double)rect.GetValue(Canvas.LeftProperty));

            Line line2 = new Line();
            line2.Stroke = new SolidColorBrush(Colors.Black);
            line2.SetValue(Canvas.TopProperty, (double)rect.GetValue(Canvas.TopProperty));
            line2.SetValue(Canvas.LeftProperty, (double)rect.GetValue(Canvas.LeftProperty));

            //交换
            if (flag == 2)
            {
                line1.X1 = 0;
                line1.Y1 = rect.Height / 6;
                line1.X2 = rect.Width;
                line1.Y2 = (rect.Height * 5) / 6;

                line2.X1 = 0;
                line2.Y1 = (rect.Height * 5) / 6;
                line2.X2 = rect.Width;
                line2.Y2 = rect.Height / 6;

                MainWindow.mainwindow.canvas.Children.Add(line1);
                MainWindow.mainwindow.canvas.Children.Add(line2);

            }
            //直通
            else if (flag == 1)
            {

                line1.X1 = 0;
                line1.Y1 = rect.Height / 6;
                line1.X2 = rect.Width;
                line1.Y2 = rect.Height / 6;

                line2.X1 = 0;
                line2.Y1 = (rect.Height * 5) / 6;
                line2.X2 = rect.Width;
                line2.Y2 = (rect.Height * 5) / 6;
                MainWindow.mainwindow.canvas.Children.Add(line1);
                MainWindow.mainwindow.canvas.Children.Add(line2);

            }
        }
开发者ID:ForeverSc,项目名称:NewIOTSystem,代码行数:48,代码来源:CreateView.cs

示例5: CreateLine

        private static Line CreateLine(double x1, double y1, double x2, double y2, Pen pen)
        {
            var line = new Line
            {
                X1 = x1,
                Y1 = y1,
                X2 = x2,
                Y2 = y2,
                StrokeThickness = pen.Thickness,
                Stroke = pen.Brush,
                StrokeDashArray = pen.DashStyle.Dashes,
                SnapsToDevicePixels = true,
                StrokeDashCap = PenLineCap.Square
            };

            line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
            return line;
        }
开发者ID:rpeshkov,项目名称:VisualMethodSeparators,代码行数:18,代码来源:VmsViewportAdornment.cs

示例6: DrawLine_Clicked

        private void DrawLine_Clicked(object sender, RoutedEventArgs e)
        {
            var window = new EditPosition() { Owner = this, WindowStartupLocation = WindowStartupLocation.CenterOwner };
            var vm = new EditPositionVm();
            window.DataContext = vm;

            window.ShowDialog();

            if (window.DialogResult == true)
            {
                var line = new Line() { X1 = 0, Y1 = 0, X2 = 150, Y2 = 320 ,Stroke = new SolidColorBrush(Colors.Red), StrokeThickness = 2};
                Canvas.SetLeft(line, vm.Left);
                Canvas.SetTop(line, vm.Top);
                this.DrawCanvas.Children.Add(line);

                //Add drag drop behavior
                line.SetValue(DragDropBehavior.PlacementTarget, this.DrawCanvas);
            }

            
        }
开发者ID:fjkfjk,项目名称:ExerciseDemo,代码行数:21,代码来源:MainWindow.xaml.cs

示例7: DrawGridlines

        /// <summary>
        /// Draw the gridlines for a particualr trace.  At this stage the gridlines and scales are based on min/masx valeus.
        /// In the future, we could allow the user to specifiy number of ticks, min/max etc.
        /// </summary>
        /// <param name="seriesName"></param>
        /// <param name="minY"></param>
        /// <param name="maxY"></param>
        /// <param name="yScale"></param>
        /// <param name="yIncrements"></param>
        /// <param name="yDistance"></param>
        /// <param name="xIncrements"></param>
        /// <param name="xOffset"></param>
        /// <param name="xMargin"></param>
        /// <param name="yMargin"></param>
        /// <param name="minX"></param>
        /// <param name="maxX"></param>
        /// <param name="holeID"></param>
        private void DrawGridlines(string seriesName, double minY, double maxY, double yScale, int yIncrements, 
            double yDistance, double xIncrements, int xOffset, int xMargin, int yMargin, double minX, double maxX, string title)
        {
            double incY = yDistance / (double)yIncrements;
            double currentY = minY;

            GeneralText gtName = new GeneralText(title, xMargin + xOffset, yMargin - 45, true, false, TextAlignment.Left);
            drawingCanvas.Children.Add(gtName);

            GeneralText gt = new GeneralText(seriesName, xMargin + xOffset, yMargin - 30, true, false, TextAlignment.Left);
            drawingCanvas.Children.Add(gt);

            for (int i = 0; i < yIncrements + 1; i++)
            {

                double cv = currentY + (incY * i);
                double screenPos = (cv - minY) / yScale;

                Line ly = new Line();
                ly.X1 = xMargin + xOffset + 0;
                ly.X2 = xMargin + xOffset + 100;
                ly.Y1 = yMargin + screenPos;
                ly.Y2 = yMargin + screenPos;
                ly.Stroke = Brushes.LightGray;
                ly.StrokeThickness = 1;
                ly.SnapsToDevicePixels = true;
                ly.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
                drawingCanvas.Children.Add(ly);


            }

            string minXText = string.Format("{0:0.###}", minX);
            string maxXText = string.Format("{0:0.###}", maxX);
            if (minX == double.MaxValue)
            {
                minXText = "0";
            }
            if (maxX == double.MinValue)
            {
                maxXText = "0";
            }
            GeneralText gt1 = new GeneralText(minXText, xMargin + xOffset, yMargin - 15, false, true, TextAlignment.Left);
            drawingCanvas.Children.Add(gt1);

            GeneralText gt2 = new GeneralText(maxXText, xMargin + xOffset + 100, yMargin - 15, false, true, TextAlignment.Right);
            drawingCanvas.Children.Add(gt2);


            for (int i = 0; i < xIncrements + 1; i++)
            {
                Line lx1 = new Line();
                lx1.X1 = xMargin + xOffset + (i * 10);
                lx1.X2 = xMargin + xOffset + (i * 10);
                lx1.Y1 = yMargin + 0;
                lx1.Y2 = yMargin + ((maxY - minY) / yScale);

                lx1.Stroke = Brushes.LightGray;
                lx1.StrokeThickness = 1;
                lx1.SnapsToDevicePixels = true;
                lx1.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
                drawingCanvas.Children.Add(lx1);
            }

            Rectangle outline = new Rectangle();
            outline.Width = 100;
            outline.Height = ((maxY - minY) / yScale);
            outline.Stroke = Brushes.Black;
            Canvas.SetLeft(outline, xMargin + xOffset);
            Canvas.SetTop(outline, yMargin);

            drawingCanvas.Children.Add(outline);

        }
开发者ID:dioptre,项目名称:nkd,代码行数:91,代码来源:CollarRenderPanel.xaml.cs

示例8: Paint

        private void Paint(Size finalSize)
        {
            //maxValue = 100;
            var circleWidth = 4d;
            var pointWidth = 4d;
            var keduWidth = 1d;
            var keduLength = 5d;
            var standWidth = 3d;

            var startDegree = 290d;
            var standLength = 10d;
            var minValue = MinValue;
            var maxValue = MaxValue;
            if (minValue >= maxValue)
                return;
            //if (currenValue < minValue || currenValue > maxValue)
            //{
            //    currenValue = (minValue + maxValue) / 2;
            //}
            var widthSpan = 40d;
            var heightSpan = 20d;
            var width = finalSize.Width;
            var height = finalSize.Height;

            if (width < 100d || height < 50d)
            {
                this.Width = width = 100d;
                this.Height = height = 50d;
            }
            var centerX = (width - widthSpan) / 2d + heightSpan;
            var centerY = height - heightSpan + 10d;

            //Single MyWidth, MyHeight;
            //MyWidth = Width - widthSpan;
            //MyHeight = Height - heightSpan;
            //Single DI = 2 * MyHeight;
            //if (MyWidth < MyHeight)
            //{
            //    DI = MyWidth;
            //}

            var degreePerStandKeDu = (720d - 2d * startDegree) / 5d;  //计算出每个标准大刻度之间的角度
            var degreePerKeDu = degreePerStandKeDu / 5d;
            var valuePerKeDu = (maxValue - minValue) / 5;  //每个大刻度之间的值

            //Rectangle MyRect;
            //g = e.Graphics;
            //g.Clear(this.BackColor);
            //g.DrawRectangle(new Pen(Color.Black, 2), 2, 2, this.Width - 4, this.Height - 4);
            _background.SetValue(WidthProperty, width);
            _background.SetValue(HeightProperty, height);

            //MyRect = new Rectangle(0, 0, this.Width, this.Height);
            //g.SmoothingMode = SmoothingMode.AntiAlias;
            ////将绘图平面的坐标原点移到窗口中心
            //g.TranslateTransform(MyWidth / 2 + heightSpan, MyHeight + 10);
            //绘制表盘
            //g.FillEllipse(Brushes.Black,MyRect);
            //string word = currenValue.ToString().Trim() + title;
            //int len = ((word.Trim().Length) * (myFont.Height)) / 2;
            //g.DrawString(word.Trim(), myFont, Brushes.Red, new PointF(-len / 2, -MyHeight / 2 - myFont.Height / 2));
            Size textSize = _text.MeasureTextSize();
            _text.SetValue(Canvas.LeftProperty, centerX - textSize.Width / 2d);
            _text.SetValue(Canvas.TopProperty, centerY - (height - heightSpan - textSize.Height) / 2d);

            //g.RotateTransform(startDegree);
            //绘制刻度标记
            _calibrationCanvas.Children.Clear();
            var calibrationBrush = new SolidColorBrush(Colors.Green);
            _calibrationCanvas.Background = calibrationBrush;
            var calibrationLeft = centerX - 2d;
            var calibrationTop = centerY + 2d - height + heightSpan;
            var calibrationDegree = startDegree;
            var origin = new Point(0.5d, (centerY - calibrationTop) / keduLength);
            for (int x = 0; x < 26; x++)
            {
                //g.FillRectangle(Brushes.Green, new Rectangle(-2, (System.Convert.ToInt16(DI) / 2 - 2) * (-1), keduWidth, keduLength));
                //g.RotateTransform(degreePerKeDu);
                var calibrationLine = new Rectangle();
                calibrationLine.SetValue(Canvas.LeftProperty, calibrationLeft);
                calibrationLine.SetValue(Canvas.TopProperty, calibrationTop);
                calibrationLine.SetValue(WidthProperty, keduWidth);
                calibrationLine.SetValue(HeightProperty, keduLength);
                calibrationLine.Fill = calibrationBrush;
                calibrationLine.RenderTransformOrigin = origin;
                calibrationLine.RenderTransform = new RotateTransform() { Angle = calibrationDegree, };
                _calibrationCanvas.Children.Add(calibrationLine);
                calibrationDegree += degreePerKeDu;
            }
            ////重置绘图平面的坐标变换
            //g.ResetTransform();
            //g.TranslateTransform(MyWidth / 2 + heightSpan, MyHeight + 10);
            //g.RotateTransform(startDegree);
            //mySpeed = minValue;
            ////绘制刻度值
            var speed = minValue;
            var labelBrush = new SolidColorBrush(Colors.Red);
            var lableLineLeft = centerX - 3d;
            var lableLineTop = centerY + 2d - height + heightSpan;
            var labelTop = centerY - (height - heightSpan) + 26d;
//.........这里部分代码省略.........
开发者ID:Jitlee,项目名称:WPFMonitor,代码行数:101,代码来源:DLBiaoPan.cs

示例9: DivideGrid

        private void DivideGrid(int countGamers)
        {
            try
            {
                double angle = 360.0 / countGamers;
                double transformAngleLine = -90;
                double transformAngleNumber = 0;
                for (int i = 0; i < countGamers; i++)
                {
                    Line myLine = new Line();
                    transformAngleLine += angle;
                    transformAngleNumber = transformAngleLine - angle / 2;
                    string nameLine = "myLine" + i.ToString();
                    myLine.Stroke = new SolidColorBrush(colorLine);
                    myLine.X1 = LayoutRoot.ActualWidth / 2;
                    myLine.X2 = LayoutRoot.ActualWidth;
                    myLine.Y1 = LayoutRoot.ActualHeight / 2;
                    myLine.Y2 = LayoutRoot.ActualHeight / 2;
                    myLine.StrokeThickness = 3;
                    myLine.SetValue(Grid.RowProperty, 0);
                    myLine.SetValue(Grid.RowSpanProperty, 2);
                    myLine.Name = nameLine;
                    RotateTransform MyTransform = new RotateTransform();
                    myLine.RenderTransform = MyTransform;
                    myLine.RenderTransformOrigin = new Point(0.5, 0.5);
                    MyTransform.Angle = transformAngleLine;
                    LayoutRoot.Children.Add(myLine);

                    TextBlock numberGamer = new TextBlock();
                    numberGamer.Name = "number" + i.ToString();
                    numberGamer.Text = (i + 1).ToString();
                    numberGamer.HorizontalAlignment = HorizontalAlignment.Center;
                    numberGamer.VerticalAlignment = VerticalAlignment.Center;
                    numberGamer.FontSize = GridNumberGamer.ActualHeight * 80 / 100;
                    numberGamer.TextWrapping = TextWrapping.NoWrap;
                    numberGamer.FontFamily = new FontFamily("Comic Sans MS");

                    Border b = new Border();
                    Border b2 = new Border();
                    b.BorderThickness = b2.BorderThickness = new Thickness(3);
                    b.CornerRadius = b2.CornerRadius = new CornerRadius(20);
                    b.BorderBrush = b2.BorderBrush = new SolidColorBrush(colorLine);
                    b.Child = numberGamer;
                    b.Height = b.Width = b2.Height = b2.Width = GridNumberGamer.ActualHeight;

                    if (GridNumberGamer.ActualHeight > GridNumberGamer.ColumnDefinitions[1].ActualWidth)
                    {
                        b.Margin = b2.Margin = new Thickness(0, 0, -GridNumberGamer.ActualHeight + GridNumberGamer.ColumnDefinitions[1].ActualWidth, 0);
                    }
                    b2.Background = new SolidColorBrush(Colors.Black);
                    b2.Opacity = 0.4;
                    var radius = LayoutRoot.ActualHeight / 2 * 84 / 100;

                    var y0 = LayoutRoot.ActualHeight / 2 * 84 / 100;
                    var х1 = (Math.Cos(Math.PI * transformAngleNumber / 180) * radius);
                    var у1 = y0 + (Math.Sin(Math.PI * transformAngleNumber / 180) * radius);
                    MatrixTransform matrixTransform = new MatrixTransform();
                    b.RenderTransform = b2.RenderTransform = matrixTransform;
                    matrixTransform.Matrix = new Matrix(1, 0, 0, 1, х1, у1);

                    b2.SetValue(Grid.ColumnProperty, 1);
                    b.SetValue(Grid.ColumnProperty, 1);
                    GridNumberGamer.Children.Add(b2);
                    GridNumberGamer.Children.Add(b);
                    backButton.Height = GridNumberGamer.ActualHeight;
                }

                BottleImage = new Image();
                BottleImage.Name = "bottleImage";
                BottleImage.Source = new BitmapImage(new Uri(bottleRepository.GetBottle(numberBottle).Path, UriKind.RelativeOrAbsolute));
                BottleImage.RenderTransformOrigin = new Point(0.5, 0.5);
                RotateTransform rotateBottle = new RotateTransform();
                rotateBottle.Angle = 10;
                BottleImage.RenderTransform = rotateBottle;
                BottleImage.SetValue(Grid.RowProperty, 0);
                BottleImage.SetValue(Grid.RowSpanProperty, 2);
                BottleImage.Tapped += bottleImage_Start;
                BottleImage.PointerPressed += bottleImage_PointerPressed;
                BottleImage.Height = GridBottle.ActualHeight;
                BottleImage.HorizontalAlignment = HorizontalAlignment.Center;
                BottleImage.VerticalAlignment = VerticalAlignment.Center;
                LayoutRoot.Children.Add(BottleImage);
            }
            catch (Exception ex)
            {
                var a = ex.Message;
            }
        }
开发者ID:Julia-Bobko,项目名称:Bottle,代码行数:88,代码来源:Game.xaml.cs

示例10: UpdateGuide

		/// <summary>
		/// Updates the line <paramref name="guide"/> with a new format.
		/// </summary>
		/// <param name="guide">The <see cref="Line"/> to update.</param>
		/// <param name="formatIndex">The new format index.</param>
		void UpdateGuide(LineSpan lineSpan, Line adornment)
		{
			if (lineSpan == null || adornment == null) return;

			LineFormat format;
			if (lineSpan.Type == LineSpanType.PageWidthMarker)
			{
				if (!Theme.PageWidthMarkers.TryGetValue(lineSpan.Indent, out format))
				{
					format = Theme.DefaultLineFormat;
				}
			}
			else if (!Theme.LineFormats.TryGetValue(lineSpan.FormatIndex, out format))
			{
				format = Theme.DefaultLineFormat;
			}

			if (!format.Visible)
			{
				adornment.Visibility = Visibility.Hidden;
				return;
			}

			bool highlight = lineSpan.Highlight || lineSpan.LinkedLines.Any(ls => ls.Highlight);

			var lineStyle = highlight ? format.HighlightStyle : format.LineStyle;
			var lineColor = (highlight && !lineStyle.HasFlag(LineStyle.Glow)) ?
				format.HighlightColor : format.LineColor;

			Brush brush;
			if (!GuideBrushCache.TryGetValue(lineColor, out brush))
			{
				brush = new SolidColorBrush(lineColor.ToSWMC());
				if (brush.CanFreeze) brush.Freeze();
				GuideBrushCache[lineColor] = brush;
			}

			adornment.Stroke = brush;
			adornment.StrokeThickness = lineStyle.GetStrokeThickness();
			adornment.StrokeDashArray = lineStyle.GetStrokeDashArray();

			if (lineStyle.HasFlag(LineStyle.Dotted) || lineStyle.HasFlag(LineStyle.Dashed))
			{
				adornment.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Unspecified);
			}
			else
			{
				adornment.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased);
			}

			if (lineStyle.HasFlag(LineStyle.Glow))
			{
				Effect effect;
				var glowColor = highlight ? format.HighlightColor : format.LineColor;
				if (!GlowEffectCache.TryGetValue(glowColor, out effect))
				{
					effect = new DropShadowEffect
					{
						Color = glowColor.ToSWMC(),
						BlurRadius = LineStyle.Thick.GetStrokeThickness(),
						Opacity = 1.0,
						ShadowDepth = 0.0,
						RenderingBias = RenderingBias.Performance
					};
					if (effect.CanFreeze) effect.Freeze();
					GlowEffectCache[glowColor] = effect;
				}
				try
				{
					adornment.Effect = effect;
				}
				catch (COMException)
				{
					// No sensible way to deal with this exception, so we'll
					// fall back on changing the color.
					adornment.Effect = null;
					if (!GuideBrushCache.TryGetValue(glowColor, out brush))
					{
						brush = new SolidColorBrush(glowColor.ToSWMC());
						if (brush.CanFreeze) brush.Freeze();
						GuideBrushCache[glowColor] = brush;
					}
					adornment.Stroke = brush;
				}
			}
			else
			{
				adornment.Effect = null;
			}
		}
开发者ID:iccfish,项目名称:indent-guides-mod,代码行数:95,代码来源:IndentGuide.cs

示例11: DrawField

        public void DrawField(object sender, EventArgs e)
        {
            MyEventArgs.DrawFieldArgs drawFieldArgs = (MyEventArgs.DrawFieldArgs)e;
            string type = drawFieldArgs.Type;
            int x = drawFieldArgs.XPos;
            int y = drawFieldArgs.YPos;

            Debug.WriteLine("Draw field main, Type: " + type + ", X: " + x + ", Y: " + y + ".");

            switch (type)
            {
                case "Field":
                case "Forest":
                case "StartField":
                case "SafeField":
                case "GoalField":
                case "BarricadeField":
                    Ellipse myCircle = new Ellipse();
                    myCircle.StrokeThickness = CellSize/5;
                    myCircle.Stroke = Brushes.Transparent;
                    myCircle.HorizontalAlignment = HorizontalAlignment.Stretch;
                    myCircle.VerticalAlignment = VerticalAlignment.Stretch;
                    myCircle.SetValue(Grid.ColumnProperty, x);
                    myCircle.SetValue(Grid.RowProperty, y);

                    switch (type)
                    {
                        case "Field":
                            myCircle.Fill = Brushes.Black;
                            break;

                        case "Forest":
                            myCircle.Fill = Brushes.DarkGreen;
                            break;

                        case "StartField":
                            myCircle.Fill = Brushes.White;
                            break;

                        case "SafeField":
                            myCircle.Fill = Brushes.Cyan;
                            break;

                        case "GoalField":
                            myCircle.Fill = Brushes.LightGreen;
                            break;
                        case "BarricadeField":
                            myCircle.Fill = Brushes.Red;
                            break;
                    }
                    SpelGrid.Children.Add(myCircle);
                    break;
                case "LinkField":
                case "LinkLeft":
                case "LinkUp":
                    Line myLine = new Line();
                    myLine.StrokeThickness = 5;
                    myLine.Stroke = Brushes.Black;
                    myLine.SetValue(Grid.ColumnProperty, x);
                    myLine.SetValue(Grid.RowProperty, y);
                    switch (type)
                    {
                        case "LinkField":
                            myLine.HorizontalAlignment = HorizontalAlignment.Center;
                            myLine.VerticalAlignment = VerticalAlignment.Top;
                            myLine.X1 = 2;
                            myLine.X2 = 2;
                            myLine.Y1 = 0;
                            myLine.Y2 = CellSize;
                            break;
                        case "LinkLeft":
                            myLine.HorizontalAlignment = HorizontalAlignment.Left;
                            myLine.VerticalAlignment = VerticalAlignment.Center;
                            myLine.X1 = -(CellSize / 5)+3;
                            myLine.X2 = (CellSize / 5)-3;
                            myLine.Y1 = 2;
                            myLine.Y2 = 2;
                            break;
                        case "LinkUp":
                            myLine.HorizontalAlignment = HorizontalAlignment.Center;
                            myLine.VerticalAlignment = VerticalAlignment.Top;
                            myLine.X1 = 2;
                            myLine.X2 = 2;
                            myLine.Y1 = -(CellSize / 5)+3;
                            myLine.Y2 = (CellSize / 5)-3;
                            break;
                    }
                    SpelGrid.Children.Add(myLine);
                    break;
            }
        }
开发者ID:Chirimorin,项目名称:BarricadeSpel,代码行数:91,代码来源:MainWindow.xaml.cs

示例12: CreateBevelFor2DArea

        private static void CreateBevelFor2DArea(Canvas areaCanvas, DataPoint currentDataPoint, DataPoint previusDataPoint, Boolean clipAtStart, Boolean clipAtEnd)
        {
            Line line4Bevel42DArea = new Line(){
                StrokeThickness = 2.4,
                Stroke = Graphics.GetBevelTopBrush(currentDataPoint.Parent.Color),
                StrokeEndLineCap = PenLineCap.Round,
                StrokeStartLineCap = PenLineCap.Triangle,
                IsHitTestVisible = false
            };

            line4Bevel42DArea.SetValue(Canvas.ZIndexProperty, (Int32) 2);
            line4Bevel42DArea.X1 = previusDataPoint.Faces.AreaFrontFaceLineSegment.Point.X ;
            line4Bevel42DArea.Y1 = previusDataPoint.Faces.AreaFrontFaceLineSegment.Point.Y;
            line4Bevel42DArea.X2 = currentDataPoint._visualPosition.X;
            line4Bevel42DArea.Y2 = currentDataPoint._visualPosition.Y;
            currentDataPoint.Faces.BevelLine = line4Bevel42DArea;
            previusDataPoint.Faces.BevelLine = line4Bevel42DArea;
            areaCanvas.Children.Add(line4Bevel42DArea);
        }
开发者ID:tdhieu,项目名称:openvss,代码行数:19,代码来源:AreaChart.cs

示例13: GetNewMarkerForLineChart

        /// <summary>
        /// Customize the marker for legend in Line chart
        /// </summary>
        /// <param name="marker"></param>
        /// <returns></returns>
        private Canvas GetNewMarkerForLineChart(Marker marker)
        {
            Canvas lineMarker = new Canvas();
            Line line = new Line() { Tag = marker.Tag };

            line.Margin = new Thickness(EntryMargin);
            line.Stroke = (marker.BorderColor);

            Double height = marker.TextBlockSize.Height > marker.MarkerSize.Height ? marker.TextBlockSize.Height : marker.MarkerSize.Height;
            lineMarker.Height = marker.MarkerActualSize.Height;

            line.X1 = 0;
            line.X2 = ENTRY_SYMBOL_LINE_WIDTH;
            line.Y1 = 0;
            line.Y2 = 0;
            line.Width = ENTRY_SYMBOL_LINE_WIDTH;

            lineMarker.Width = marker.MarkerActualSize.Width + ENTRY_SYMBOL_LINE_WIDTH / 2;

            line.StrokeDashArray = ApplyLineStyleForMarkerOfLegendEntry(line, marker.DataSeriesOfLegendMarker.LineStyle.ToString());

            lineMarker.Children.Add(line);

            lineMarker.Children.Add(marker.Visual);

            if (!(InternalVerticalAlignment == VerticalAlignment.Center && (InternalHorizontalAlignment == HorizontalAlignment.Left || InternalHorizontalAlignment == HorizontalAlignment.Right)))
            {
                line.Margin = new Thickness(ENTRY_SYMBOL_LINE_WIDTH / 2, marker.Visual.Margin.Top, marker.Visual.Margin.Right, marker.Visual.Margin.Bottom);
                marker.Visual.Margin = new Thickness(ENTRY_SYMBOL_LINE_WIDTH / 2, marker.Visual.Margin.Top, marker.Visual.Margin.Right, marker.Visual.Margin.Bottom);
            }

#if WPF
            line.SetValue(Canvas.TopProperty, height/2 );
#else
            line.Height = 8;
            line.SetValue(Canvas.TopProperty, (height / 2) + .4876);
#endif

            line.SetValue(Canvas.LeftProperty, (Double)(-marker.MarkerSize.Width / 2) - .4876);

            return lineMarker;
        }
开发者ID:zhangzy0193,项目名称:visifire,代码行数:47,代码来源:Legend.cs

示例14: CompendiumMapDepthMap_MouseRightButtonDown

        public void CompendiumMapDepthMap_MouseRightButtonDown(object sender, MouseButtonEventArgs e)
        {
            _currentMousePosition = e.GetPosition(caller);
            _isRightMouseButtonDown = true;
            _mouseMovedWhileRMBDown = false;
            NodeRelationshipHelper nrh = IoC.IoCContainer.GetInjectionInstance().GetInstance<NodeRelationshipHelper>();
            if (nrh.FromNode != null)
            {
                _startLinePosition = nrh.GetCenterOfFromNode();
                _tempRelationshipLine = new Line();
                _tempRelationshipLine.StrokeThickness = 1.25;
                _tempRelationshipLine.Stroke = new SolidColorBrush(Colors.Black);
                _tempRelationshipLine.Opacity = 0.40;
                _tempRelationshipLine.X1 = _startLinePosition.X;
                _tempRelationshipLine.Y1 = _startLinePosition.Y;
                _tempRelationshipLine.X2 = _startLinePosition.X;
                _tempRelationshipLine.Y2 = _startLinePosition.Y;
                _tempRelationshipLine.SetValue(Canvas.ZIndexProperty, -1);
                caller.uxMapSurface.Children.Add(_tempRelationshipLine);

                Thread rightClickDelayThread = new Thread(this.ShowNodeContextMenu);
                rightClickDelayThread.Start(nrh.FromNode.DataContext as INodeProxy);
            }
            else if (nrh.Relationship != null)
            {
                Thread rightCLickDelayThread = new Thread(this.ShowRelationshipContextMenu);
                rightCLickDelayThread.Start(nrh.Relationship.DataContext as IRelationshipProxy);
            }
            else
            {
                _originalPanPosition = _currentMousePosition;
                Thread rightClickDelayThread = new Thread(this.ShowCanvasContextMenu);
                rightClickDelayThread.Start();
            }
            e.Handled = true;
        }
开发者ID:chris-tomich,项目名称:Glyma,代码行数:36,代码来源:MouseKeyboardEvents.cs

示例15: UpdateShorestPathControls

        private void UpdateShorestPathControls(FriendsVertex CurrentSelectedFriend, FriendsVertex CurrentShorestPathTarget)
        {
            if (CurrentSelectedFriend.Uid == 0d)
                return;

            if (CurrentShorestPathTarget.Uid == 0d)
                return;

            //Clear
            foreach (FriendsVertex fv in vertexShorestPath)
            {
                fv.State.IsShorestPathMember = false;
                fv.State.IsShorestPathTarget = false;
            }

            //Clear
            foreach (Line L in edgeShorestPathControls)
            {
                ZoomPanCanvas.Children.Remove(L);
            }

            List<FriendsEdge> shorestPath = friendsGraph.GetShorestPath(CurrentSelectedFriend, CurrentShorestPathTarget);

            foreach (FriendsEdge edge in shorestPath)
            {
                vertexShorestPath.Add(edge.Source);
                vertexShorestPath.Add(edge.Target);
                edge.Source.State.IsShorestPathMember = true;
                edge.Target.State.IsShorestPathTarget = true;

                int vertexCenter = 28;

                Line L = new Line();
                L.Fill = new SolidColorBrush(Colors.Red);
                L.Stroke = new SolidColorBrush(Colors.Red);
                L.StrokeThickness = 4d;
                L.X1 = edge.Source.Layout.FlockPoint.X + vertexCenter;
                L.Y1 = edge.Source.Layout.FlockPoint.Y + vertexCenter;
                L.X2 = edge.Target.Layout.FlockPoint.X + vertexCenter;
                L.Y2 = edge.Target.Layout.FlockPoint.Y + vertexCenter;
                L.SetValue(Canvas.ZIndexProperty, 2);

                if (isFlockLayout)
                    L.Visibility = Visibility.Visible;
                else
                    L.Visibility = Visibility.Collapsed;

                edgeShorestPathControls.Add(L);
                ZoomPanCanvas.Children.Add(L);
            }
        }
开发者ID:LimeyJohnson,项目名称:RandomProjects,代码行数:51,代码来源:CanvasModel.cs


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