void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MainWindow = ((ExplorerPanel.PopOk)(target)); return; case 2: this.OverLay = ((System.Windows.Controls.Grid)(target)); return; case 3: this.rectangle = ((System.Windows.Shapes.Rectangle)(target)); return; case 4: this.line = ((System.Windows.Shapes.Line)(target)); return; case 5: this.CC_Main = ((System.Windows.Controls.ContentControl)(target)); return; case 6: this.TBK_Content = ((System.Windows.Controls.TextBlock)(target)); return; case 7: this.BTN_Ok = ((System.Windows.Controls.Button)(target)); return; } this._contentLoaded = true; }
public static void Set(this System.Windows.Shapes.Line line, PointPair coordinates) { line.X1 = coordinates.P1.X.Round() + 0.5; line.Y1 = coordinates.P1.Y.Round() + 0.5; line.X2 = coordinates.P2.X.Round() + 0.5; line.Y2 = coordinates.P2.Y.Round() + 0.5; }
/// <summary> /// Draws the icon to display. /// </summary> /// <param name="arrangeBounds">The bounds to draw in.</param> /// <param name="canvas">The canvas to draw on.</param> /// <param name="centerX">The center along the x axis.</param> /// <param name="centerY">The center along the y axis.</param> /// <param name="squareLength">The length of the centered square.</param> /// <param name="squareHalfLength">The half length of the centered square.</param> /// <param name="squareLeft">The left position of the centered square.</param> /// <param name="squareRight">The right position of the centered square.</param> /// <param name="squareTop">The top position of the centered square.</param> /// <param name="squareBottom">The bottom position of the centered square.</param> protected override void DrawIcon( Size arrangeBounds, Canvas canvas, int centerX, int centerY, int squareLength, int squareHalfLength, int squareLeft, int squareRight, int squareTop, int squareBottom) { int shapePadding = 9; Line line = new Line(); line.X1 = squareLeft + shapePadding; line.Y1 = squareTop + shapePadding; line.X2 = squareRight - shapePadding; line.Y2 = squareBottom - shapePadding; line.Stroke = Foreground; line.StrokeThickness = 2; line.StrokeEndLineCap = PenLineCap.Flat; canvas.Children.Add(line); line = new Line(); line.X1 = squareRight - shapePadding; line.Y1 = squareTop + shapePadding; line.X2 = squareLeft + shapePadding; line.Y2 = squareBottom - shapePadding; line.Stroke = Foreground; line.StrokeThickness = 2; line.StrokeEndLineCap = PenLineCap.Flat; canvas.Children.Add(line); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PART_Canvas = ((System.Windows.Controls.Canvas)(target)); return; case 2: this.EllipseA = ((System.Windows.Shapes.Ellipse)(target)); return; case 3: this.EllipseB = ((System.Windows.Shapes.Ellipse)(target)); return; case 4: this.Hour = ((System.Windows.Shapes.Line)(target)); return; case 5: this.Minute = ((System.Windows.Shapes.Line)(target)); return; case 6: this.Second = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 11 "..\..\Window1.xaml" ((BarChart.Window1)(target)).Loaded += new System.Windows.RoutedEventHandler(this.Window_Loaded); #line default #line hidden return; case 2: this.plot = ((System.Windows.Controls.Canvas)(target)); #line 12 "..\..\Window1.xaml" this.plot.SizeChanged += new System.Windows.SizeChangedEventHandler(this.Canvas_SizeChanged); #line default #line hidden return; case 3: this.xAxis = ((System.Windows.Shapes.Line)(target)); return; case 4: this.yAxis = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Canvass = ((System.Windows.Controls.Canvas)(target)); return; case 2: this.ColorData = ((System.Windows.Controls.Image)(target)); return; case 3: this.RightHand = ((System.Windows.Controls.Image)(target)); return; case 4: this.LeftHand = ((System.Windows.Controls.Image)(target)); return; case 5: this.RightFoot = ((System.Windows.Controls.Image)(target)); return; case 6: this.Should = ((System.Windows.Controls.Image)(target)); return; case 7: this.Shoulder = ((System.Windows.Shapes.Line)(target)); return; case 8: this.button1 = ((System.Windows.Controls.Button)(target)); #line 17 "..\..\..\MainWindow.xaml" this.button1.Click += new System.Windows.RoutedEventHandler(this.button1_Click); #line default #line hidden return; case 9: this.textBlock1 = ((System.Windows.Controls.TextBlock)(target)); return; case 10: this.textBlock2 = ((System.Windows.Controls.TextBlock)(target)); return; case 11: this.textBlock3 = ((System.Windows.Controls.TextBlock)(target)); return; case 12: this.textBlock4 = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
private void depthBtn_Click(object sender, RoutedEventArgs e) { ushort depth = 0; if (!ushort.TryParse(depthTxtBox.Text, out depth) || depth > 10) { MessageBox.Show("Select depth between 0 and 10"); return; } depthBtn.IsEnabled = false; canvas.Children.Clear(); List <CommonAlgorithms.Numerical.Line> result = new List <CommonAlgorithms.Numerical.Line>(); Recursive.DrawKochCurve(depth, new CommonAlgorithms.Numerical.Point(30, 50), 0, 500, result); foreach (var line in result) { var l = new System.Windows.Shapes.Line(); l.X1 = line.p1.X; l.Y1 = line.p1.Y; l.X2 = line.p2.X; l.Y2 = line.p2.Y; l.Stroke = Brushes.Red; l.StrokeThickness = 1; canvas.Children.Add(l); } depthBtn.IsEnabled = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/OpenIot;component/Compass.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.statusTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("statusTextBlock"))); this.timeBetweenUpdatesTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("timeBetweenUpdatesTextBlock"))); this.magneticTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("magneticTextBlock"))); this.trueTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("trueTextBlock"))); this.accuracyTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("accuracyTextBlock"))); this.orientationTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("orientationTextBlock"))); this.headingGrid = ((System.Windows.Controls.Grid)(this.FindName("headingGrid"))); this.magneticLine = ((System.Windows.Shapes.Line)(this.FindName("magneticLine"))); this.trueLine = ((System.Windows.Shapes.Line)(this.FindName("trueLine"))); this.xTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("xTextBlock"))); this.yTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("yTextBlock"))); this.zTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("zTextBlock"))); this.xLine = ((System.Windows.Shapes.Line)(this.FindName("xLine"))); this.yLine = ((System.Windows.Shapes.Line)(this.FindName("yLine"))); this.zLine = ((System.Windows.Shapes.Line)(this.FindName("zLine"))); this.calibrationStackPanel = ((System.Windows.Controls.StackPanel)(this.FindName("calibrationStackPanel"))); this.calibrationTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("calibrationTextBlock"))); this.calibrationButton = ((System.Windows.Controls.Button)(this.FindName("calibrationButton"))); }
private void DrawGrid(int columns, int rows, int cellWidth = 10) { var stroke = System.Windows.Media.Brushes.Blue; var strokeThiknes = 1; mainCanvas.Width = columns * cellWidth; mainCanvas.Height = rows * cellWidth; //draw columns for (var i = 0; i <= columns; i++) { var line = new Line { X1 = cellWidth * i, Y1 = 0 }; line.X2 = line.X1; line.Y2 = cellWidth * rows; line.Stroke = stroke; line.StrokeThickness = strokeThiknes; mainCanvas.Children.Add(line); } for (var i = 0; i <= rows; i++) { var line = new Line { X1 = 0, Y1 = cellWidth * i, Stroke = stroke, StrokeThickness = strokeThiknes, X2 = cellWidth * columns }; line.Y2 = line.Y1; mainCanvas.Children.Add(line); } }
/// <summary> /// Move with a line or a point /// </summary> private void imageBox_MouseMove(object sender, MouseEventArgs e) { if (e.LeftButton == MouseButtonState.Pressed) { if (draggingLine != null) { // moving a line Point delta = new Point(e.GetPosition(imageBox).X - originalMousePosition.X, e.GetPosition(imageBox).Y - originalMousePosition.Y); ChangeMargins(delta.X, delta.Y); } else if (draggingPoint != null && mode == CalibrationMode.PERSPECTIVE) { // moving a point in perspective mode Point delta = new Point(e.GetPosition(imageBox).X - originalMousePosition.X, e.GetPosition(imageBox).Y - originalMousePosition.Y); TransformPerspective(delta.X); } else if (draggingPoint != null && mode == CalibrationMode.RECTANGLE) { // moving a point in rectangle mode Point delta = new Point(e.GetPosition(imageBox).X - originalMousePosition.X, e.GetPosition(imageBox).Y - originalMousePosition.Y); draggingPoint.Margin = new Thickness(draggingPoint.Margin.Left + delta.X, draggingPoint.Margin.Top + delta.Y, 0, 0); } } else { draggingLine = null; draggingPoint = null; } originalMousePosition = e.GetPosition(imageBox); // save mouse position }
private void AddConnection(EntityControl e1, EntityControl e2, RealtionShipType t) { System.Windows.Shapes.Line l = new System.Windows.Shapes.Line(); l.Stroke = new SolidColorBrush(Colors.Black); l.StrokeThickness = 2.0; l.X1 = Canvas.GetLeft(e1) + e1.Width; l.X2 = Canvas.GetLeft(e2); l.Y1 = Canvas.GetTop(e1) + e1.Height / 2; l.Y2 = Canvas.GetTop(e2) + e2.Height / 2; Editor.Children.Add(l); Ellipse e = new Ellipse(); e.Height = 15; e.Fill = new SolidColorBrush(Colors.Black); e.Width = 15; if (t == RealtionShipType.OneToMany) { Canvas.SetLeft(e, l.X2 - 15 / 2); Canvas.SetTop(e, l.Y2 - 15 / 2); } else { Canvas.SetLeft(e, l.X1 - 15 / 2); Canvas.SetTop(e, l.Y1 - 15 / 2); } Editor.Children.Add(e); }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MainGrid = ((System.Windows.Controls.Grid)(target)); return; case 2: this.TopLine = ((System.Windows.Shapes.Line)(target)); return; case 3: this.LastArrivalSec1 = ((System.Windows.Controls.Label)(target)); return; case 4: this.LastArrivalSec = ((System.Windows.Controls.Label)(target)); return; case 5: this.LastArrivalSec2 = ((System.Windows.Controls.Label)(target)); return; case 6: this.Average057Term = ((System.Windows.Controls.Label)(target)); return; case 7: this.TopPanel = ((gajwa_businfo.CampaignPanel)(target)); return; } this._contentLoaded = true; }
public LightweightDemo() { InitializeComponent(); Stopwatch timer = new Stopwatch(); timer.Start(); Process currentProcess = Process.GetCurrentProcess(); long usedMemory = currentProcess.PrivateMemorySize64; for (int i = 0; i < 10000; i++) { //AShape shape = ShapeFactory.getShape(getRanColor()); //shape.Draw(Canvas, getRanX(), getRanX(), getRanY(), getRanY()); System.Windows.Shapes.Line line = new System.Windows.Shapes.Line(); line.X1 = getRanX(); line.X2 = getRanX(); line.Y1 = getRanY(); line.Y2 = getRanY(); line.Stroke = getRanColor(); line.StrokeThickness = 5; Canvas.Children.Add(line); } timer.Stop(); long usedMemory2 = currentProcess.PrivateMemorySize64; label.Content = "Draw in " + timer.Elapsed.TotalMilliseconds.ToString() + " milis With : " + (usedMemory2) + " byte"; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this._panel = ((System.Windows.Controls.DockPanel)(target)); return; case 2: this._label = ((System.Windows.Controls.Border)(target)); return; case 3: this._gridContainer = ((System.Windows.Controls.ScrollViewer)(target)); return; case 4: this._grid = ((System.Windows.Controls.Grid)(target)); return; case 5: this._vLine = ((System.Windows.Shapes.Line)(target)); return; case 6: this._splitter = ((System.Windows.Controls.GridSplitter)(target)); return; } this._contentLoaded = true; }
public static void Set(this System.Windows.Shapes.Line line, PointPair coordinates) { line.X1 = coordinates.P1.X == double.NaN ? 0 : coordinates.P1.X; line.Y1 = coordinates.P1.Y == double.NaN ? 0 : coordinates.P1.Y; line.X2 = coordinates.P2.X == double.NaN ? 0 : coordinates.P2.X; line.Y2 = coordinates.P2.Y == double.NaN ? 0 : coordinates.P2.Y; }
private void btnDistr_Click(object sender, RoutedEventArgs e) { canvas.Children.Clear(); if (string.IsNullOrEmpty(txtBoxSequence.Text)) { return; } string[] data = txtBoxSequence.Text.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries); int width = (int)canvas.ActualWidth; int height = (int)canvas.ActualHeight; uint number = 0; int value = 0; System.Windows.Shapes.Line l; // create a line for each number foreach (var item in data) { if (uint.TryParse(item, out number)) { value = Utility.FitNumberIntoRange(0, width, number); l = new System.Windows.Shapes.Line(); l.Stroke = Brushes.Red; l.StrokeThickness = 0.1; l.X1 = value; l.X2 = value; l.Y1 = 0; l.Y2 = height; canvas.Children.Add(l); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.polyline = ((System.Windows.Shapes.Polyline)(target)); return; case 2: this.dot_from = ((System.Windows.Shapes.Rectangle)(target)); return; case 3: this.dot_to = ((System.Windows.Shapes.Rectangle)(target)); return; case 4: this.line = ((System.Windows.Shapes.Line)(target)); return; case 5: this.polygon = ((System.Windows.Shapes.Polygon)(target)); return; } this._contentLoaded = true; }
public static void RemoveMarkers(Canvas canvas) { for (int i = canvas.Children.Count - 1; i >= 0; i--) { UIElement element = canvas.Children[i]; if (element is MarkerControl) { MarkerControl marker = element as MarkerControl; canvas.Children.Remove(marker); } else if (element is System.Windows.Shapes.Line) { System.Windows.Shapes.Line line = element as System.Windows.Shapes.Line; canvas.Children.Remove(line); } else if (element is System.Windows.Shapes.Ellipse) { System.Windows.Shapes.Ellipse ellipse = element as System.Windows.Shapes.Ellipse; canvas.Children.Remove(ellipse); } else if (element is MarkerControl2) { MarkerControl2 marker = element as MarkerControl2; canvas.Children.Remove(marker); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: #line 6 "..\..\..\Control\ControlLine.xaml" ((jg.Editor.Library.Control.ControlLine)(target)).Loaded += new System.Windows.RoutedEventHandler(this.UserControl_Loaded); #line default #line hidden #line 7 "..\..\..\Control\ControlLine.xaml" ((jg.Editor.Library.Control.ControlLine)(target)).SizeChanged += new System.Windows.SizeChangedEventHandler(this.UserControl_SizeChanged); #line default #line hidden return; case 2: this.HeaderArrow = ((System.Windows.Shapes.Path)(target)); return; case 3: this.lineName = ((System.Windows.Shapes.Line)(target)); return; case 4: this.EndArrow = ((System.Windows.Shapes.Path)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.content = ((System.Windows.Controls.Canvas)(target)); return; case 2: this.horizLine = ((System.Windows.Shapes.Line)(target)); return; case 3: this.vertLine = ((System.Windows.Shapes.Line)(target)); return; case 4: this.horizGrid = ((System.Windows.Controls.Grid)(target)); return; case 5: this.horizTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.vertGrid = ((System.Windows.Controls.Grid)(target)); return; case 7: this.vertTextBlock = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public void TriggerWin(Line theLine) { var top = btn_topleft.TranslatePoint(new Point(0, 0), this); var firstPoint = theLine.PointsList[0]; var lastPoint = theLine.PointsList[theLine.PointsList.Count - 1]; var drawingLine = new System.Windows.Shapes.Line() { HorizontalAlignment = HorizontalAlignment.Left, VerticalAlignment = VerticalAlignment.Center, StrokeThickness = 15, Stroke = Brushes.Green, X1 = AdjustPosition(btn_topleft.Width, top.X, firstPoint.Y), Y1 = AdjustPosition(btn_topleft.Height, top.Y, firstPoint.X), X2 = AdjustPosition(btn_topleft.Width, top.X, lastPoint.Y), Y2 = AdjustPosition(btn_topleft.Height, top.Y, lastPoint.X) }; thegrid.Children.Add(drawingLine); lbl_message.Content = "WINNER"; lbl_message.FontSize = 48; lbl_message.Background = new LinearGradientBrush(Colors.Blue, Colors.Navy, 90); lbl_message.Opacity = 0.8; sp_BoardGrid.IsEnabled = false; }
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(1, 0); var line = new Line { X1 = geometry.Bounds.Left, Y1 = geometry.Bounds.Bottom - s_pen.Thickness, X2 = geometry.Bounds.Right, Y2 = geometry.Bounds.Bottom - s_pen.Thickness, Clip = new RectangleGeometry { Rect = clipRectangle } }; // RenderOptions.SetEdgeMode(line, EdgeMode.Aliased); ApplyPen(line, s_pen); // Shift the line over to offset the clipping we did. line.RenderTransform = new TranslateTransform(-s_pen.Thickness, 0); return new GraphicsResult(line, null); }
/// <summary> /// Draw an individual skeleton. /// </summary> /// <param name="skeleton">The skeleton to draw.</param> /// <param name="brush">The brush to use.</param> /// <param name="thickness">This thickness of the stroke.</param> private void DrawStickMan(Skeleton skeleton, Brush brush, int thickness) { foreach (var run in SkeletonSegmentRuns) { var next = this.GetJointPoint(skeleton, run[0]); for (var i = 1; i < run.Length; i++) { var prev = next; next = this.GetJointPoint(skeleton, run[i]); var line = new System.Windows.Shapes.Line { Stroke = brush, StrokeThickness = thickness, X1 = prev.X, Y1 = prev.Y, X2 = next.X, Y2 = next.Y, StrokeEndLineCap = PenLineCap.Square, StrokeStartLineCap = PenLineCap.Flat }; StickMen.Children.Add(line); } } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.MainCanvas = ((System.Windows.Controls.Canvas)(target)); return; case 2: this.OrientationArrow = ((System.Windows.Controls.Canvas)(target)); return; case 3: this.ArrowRotateTransform = ((System.Windows.Media.RotateTransform)(target)); return; case 4: this.ArrowTranslateTransform = ((System.Windows.Media.TranslateTransform)(target)); return; case 5: this.ConnectingLine = ((System.Windows.Shapes.Line)(target)); return; case 6: this.Description = ((System.Windows.Controls.TextBlock)(target)); return; } this._contentLoaded = true; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/NE555WP7;component/MainPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.TitlePanel = ((System.Windows.Controls.StackPanel)(this.FindName("TitlePanel"))); this.ApplicationTitle = ((System.Windows.Controls.TextBlock)(this.FindName("ApplicationTitle"))); this.PageTitle = ((System.Windows.Controls.TextBlock)(this.FindName("PageTitle"))); this.W1 = ((System.Windows.Shapes.Rectangle)(this.FindName("W1"))); this.W2 = ((System.Windows.Shapes.Rectangle)(this.FindName("W2"))); this.W = ((System.Windows.Shapes.Line)(this.FindName("W"))); this.W3 = ((System.Windows.Shapes.Line)(this.FindName("W3"))); this.W4 = ((System.Windows.Shapes.Line)(this.FindName("W4"))); this.W5 = ((System.Windows.Shapes.Line)(this.FindName("W5"))); this.recR1 = ((System.Windows.Shapes.Rectangle)(this.FindName("recR1"))); this.recR2 = ((System.Windows.Shapes.Rectangle)(this.FindName("recR2"))); this.recC1 = ((System.Windows.Shapes.Rectangle)(this.FindName("recC1"))); this.recC2 = ((System.Windows.Shapes.Rectangle)(this.FindName("recC2"))); this.NE555 = ((System.Windows.Shapes.Rectangle)(this.FindName("NE555"))); this.NE555Timer = ((System.Windows.Controls.TextBlock)(this.FindName("NE555Timer"))); this.Pin7 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin7"))); this.Pin6 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin6"))); this.Pin2 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin2"))); this.Pin3 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin3"))); this.Pin1 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin1"))); this.Pin5 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin5"))); this.Pin8 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin8"))); this.Pin4 = ((System.Windows.Controls.TextBlock)(this.FindName("Pin4"))); }
/// <summary> /// Render the staff for music /// </summary> /// <param name="colorString">The color the staff should be</param> /// <param name="width">Width of the staff to render</param> /// <param name="fontSize">The size of font currently being used</param> /// <returns></returns> private static Panel RenderStaff(String colorString, double width, double fontSize) { Grid grid = WPFRendering.CreateAutoSizingGrid(); //get the height of the staff for the font and use that to draw the lines. double height = WPFRendering.GetFontHeight(fontSize, Constants.MusicFonts.DEFAULT); double lineWidth = CalculateLineWidth(fontSize); int numLines = 5; //todo: different numbers of lines height -= numLines * lineWidth; double spacing = height / numLines; for (int i = 1; i <= numLines; i++) { System.Windows.Shapes.Line staffLine = new System.Windows.Shapes.Line() { X1 = 0, X2 = width + WPFRendering.GetFontFraction(Constants.Staff.STAFF_PADDING, fontSize), //todo: proper padding after line Y1 = i * spacing, Y2 = i * spacing, StrokeThickness = lineWidth, Stroke = new SolidColorBrush((Color)ColorConverter.ConvertFromString(colorString)) }; WPFRendering.RecalculateSize(staffLine); grid.Children.Add(staffLine); } grid.VerticalAlignment = VerticalAlignment.Top; WPFRendering.RecalculateSize(grid); return(grid); }
public void AddActor(string name) { var header = new Border { BorderBrush = Brushes.Black, BorderThickness = new Thickness(1), Margin = new Thickness(5), CornerRadius = new CornerRadius(3), Padding = new Thickness(15, 2, 15, 2), Child = new TextBlock { Text = name }, SnapsToDevicePixels = true, }; SeqDiagPanel.SetPosition(header, Position.OneColumn(_column, 0)); LayoutRoot.Children.Add(header); var line = new Line { StrokeThickness = 1, Y1 = 0, Y2 = 75, X1 = 0, X2 = 0, MinHeight = 75, Stroke = Brushes.Black, Stretch = Stretch.Fill, SnapsToDevicePixels = true, }; SeqDiagPanel.SetPosition(line, Position.Body(_column)); LayoutRoot.Children.Add(line); _column++; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.lEdge = ((System.Windows.Shapes.Line)(target)); return; case 2: this.lTop = ((System.Windows.Shapes.Line)(target)); return; case 3: this.lBottom = ((System.Windows.Shapes.Line)(target)); return; case 4: this.expTurns = ((System.Windows.Controls.Expander)(target)); return; case 5: this.spArea = ((System.Windows.Controls.StackPanel)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.UserControl = ((LoggingDataManager.WPFGraph.ParaTable)(target)); return; case 2: this.LayoutRoot = ((System.Windows.Controls.Border)(target)); return; case 3: this.R_CurveName = ((System.Windows.Documents.Run)(target)); return; case 4: this.R_CurveUnit = ((System.Windows.Documents.Run)(target)); return; case 5: this.TBK_MinValue = ((System.Windows.Controls.TextBlock)(target)); return; case 6: this.TBK_MaxValue = ((System.Windows.Controls.TextBlock)(target)); return; case 7: this.line4 = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Quit = ((System.Windows.Controls.MenuItem)(target)); #line 19 "..\..\..\Views\BurndownChart - Copier.xaml" this.Quit.Click += new System.Windows.RoutedEventHandler(this.Quit_Click); #line default #line hidden return; case 2: this.lnIdeal = ((System.Windows.Shapes.Line)(target)); return; case 3: this.lnCurrent = ((System.Windows.Shapes.Polyline)(target)); return; case 4: this.brdrGraphic = ((System.Windows.Controls.Border)(target)); return; case 5: this.lblDayBegin = ((System.Windows.Controls.Label)(target)); return; case 6: this.lblDayEnd = ((System.Windows.Controls.Label)(target)); return; case 7: this.lblComplexityMax = ((System.Windows.Controls.Label)(target)); return; case 8: this.lblComplexityZero = ((System.Windows.Controls.Label)(target)); return; case 9: this.btnCancel = ((System.Windows.Controls.Button)(target)); #line 36 "..\..\..\Views\BurndownChart - Copier.xaml" this.btnCancel.Click += new System.Windows.RoutedEventHandler(this.Quit_Click); #line default #line hidden #line 36 "..\..\..\Views\BurndownChart - Copier.xaml" this.btnCancel.TouchUp += new System.EventHandler <System.Windows.Input.TouchEventArgs>(this.Quit_Click); #line default #line hidden return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.Root = ((KyoeiSystem.Framework.Reports.Preview.RptObjectLabel)(target)); return; case 2: this.cText = ((System.Windows.Controls.TextBlock)(target)); return; case 3: this.cBox = ((System.Windows.Shapes.Rectangle)(target)); return; case 4: this.FrameT = ((System.Windows.Shapes.Line)(target)); return; case 5: this.FrameB = ((System.Windows.Shapes.Line)(target)); return; case 6: this.FrameL = ((System.Windows.Shapes.Line)(target)); return; case 7: this.FrameR = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.PART_AnglePicker = ((Imagin.Controls.Extended.AnglePicker)(target)); return; case 2: #line 16 "..\..\AnglePicker.xaml" ((System.Windows.Shapes.Ellipse)(target)).MouseDown += new System.Windows.Input.MouseButtonEventHandler(this.Ellipse_MouseDown); #line default #line hidden #line 17 "..\..\AnglePicker.xaml" ((System.Windows.Shapes.Ellipse)(target)).MouseMove += new System.Windows.Input.MouseEventHandler(this.Ellipse_MouseMove); #line default #line hidden #line 18 "..\..\AnglePicker.xaml" ((System.Windows.Shapes.Ellipse)(target)).MouseUp += new System.Windows.Input.MouseButtonEventHandler(this.Ellipse_MouseUp); #line default #line hidden return; case 3: this.PART_Line = ((System.Windows.Shapes.Line)(target)); return; } this._contentLoaded = true; }
public static void GenerateLegendLines(this Canvas canvas, IEnumerable<DataSeries> dataList, double textHeight, double lineLength) { const double sx = 6; const double sy = 0; int n = 1; double xText = 2 * sx + lineLength; foreach (DataSeries ds in dataList) { double yText = n * sy + (2 * n - 1) * textHeight / 2; Line line = new Line { X1 = sx, Y1 = yText, X2 = sx + lineLength, Y2 = yText }; ds.AddLinePattern(line); canvas.Children.Add(line); ds.Symbols.AddSymbol(canvas, new Point(0.5 * (line.X2 - line.X1 + ds.Symbols.SymbolSize) + 1, line.Y1)); TextBlock tb = new TextBlock { Text = ds.SeriesName }; canvas.Children.Add(tb); Canvas.SetTop(tb, yText - textHeight / 2); Canvas.SetLeft(tb, xText); n++; } }
void System.Windows.Markup.IComponentConnector.Connect(int connectionId, object target) { switch (connectionId) { case 1: this.userControl = ((GUI.Maze.MazeCell)(target)); return; case 2: this.lineUpWall = ((System.Windows.Shapes.Line)(target)); return; case 3: this.lineLeftWall = ((System.Windows.Shapes.Line)(target)); return; case 4: this.lineDownWall = ((System.Windows.Shapes.Line)(target)); return; case 5: this.lineRightWall = ((System.Windows.Shapes.Line)(target)); return; case 6: this.back = ((System.Windows.Controls.Border)(target)); return; } this._contentLoaded = true; }
public override double Show(Score score, Staff trebleStaff, Staff bassStaff, double left) { foreach (Staff staff in new[] { trebleStaff, bassStaff }) { double top = staff.top * score.Magnification; UIElement barLine = new Line { X1 = left, X2 = left, Y1 = top, Y2 = top + Staff.spaceBetweenLines * 4 * score.Magnification, Stroke = Brushes.Black, StrokeThickness = 1 }; base.AddElement(score, barLine); //score.Children.Add(barLine); //base.elements.Add(barLine); } double right = left + 1; // Czy znak zmieścił sie na pięcolinii? if (right >= score.ActualWidth - Staff.marginLeft) { // Nie zmieścił się - narysujemy ją na następnej pieciolinii. Hide(score); return -1; } right = left + 1 + Staff.spaceBetweenSigns * score.Magnification; return right; }
public void Draw(Point point) { var current = point; var line = new Line() { X1 = _startPoint.X, Y1 = _startPoint.Y, X2 = current.X, Y2 = current.Y }; line.Stroke = new SolidColorBrush(this.SelectedColor); this._canvas.Children.Add(line); _startPoint = current; }
public Line FromPoints(Point p1, Point p2) { var line = new Line { X1 = p1.X, Y1 = p1.Y, X2 = p2.X, Y2 = p2.Y, Stroke = Brushes.Wheat, StrokeThickness = 3, SnapsToDevicePixels = true }; line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased); Canvas.SetTop(line, p1.Y); Canvas.SetLeft(line, p1.X); Canvas.SetBottom(line, p2.Y); Canvas.SetRight(line, p2.X); return line; }
public static Line Faces(this HexMapItem item, int index) { var line = new Line { X1 = item.Faces[index].Item1.Item1, Y1 = -1 * item.Faces[index].Item1.Item2, X2 = item.Faces[index].Item2.Item1, Y2 = -1 * item.Faces[index].Item2.Item2 }; return line; }
private void DrawLine(Point p1, Point p2) { System.Windows.Shapes.Line line = new System.Windows.Shapes.Line(); line.X1 = p1.X; line.X2 = p2.X; line.Y1 = p1.Y; line.Y2 = p2.Y; line.Stroke = new SolidColorBrush(Colors.Red); LayoutRoot.Children.Add(line); }
public GanttDependenciesPresenter() { this.UseLayoutRounding = false; this.Loaded += GanttDependenciesPresenter_Loaded; DependencyLinker = new Line(); DependencyLinker.Stroke = new SolidColorBrush(Colors.Black); DependencyLinker.StrokeDashOffset = 3; DependencyLinker.StrokeThickness = 1; DependencyLinker.IsHitTestVisible = false; DependencyLinker.Visibility = System.Windows.Visibility.Collapsed; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/FBReader.App;component/Views/Controls/MarginGridControl.xaml", System.UriKind.Relative)); this.self = ((System.Windows.Controls.UserControl)(this.FindName("self"))); this.LeftLine = ((System.Windows.Shapes.Line)(this.FindName("LeftLine"))); this.RightLine = ((System.Windows.Shapes.Line)(this.FindName("RightLine"))); this.TopLine = ((System.Windows.Shapes.Line)(this.FindName("TopLine"))); this.BottomLine = ((System.Windows.Shapes.Line)(this.FindName("BottomLine"))); }
void _chart_OnDrawLine(object sender, Chart.DrawEventArgs<Events.DoubleDrawingData> e) { WPShapes.Line line = new WPShapes.Line(); line.Stroke = new SolidColorBrush(_colors[e.Data.SeriesNo]); line.StrokeThickness = 2; line.X1 = e.Data.XFrom; line.Y1 = e.Data.YFrom; line.X2 = e.Data.XTo; line.Y2 = e.Data.YTo; this.Children.Add(line); }
void _chart_OnDrawGridLine(object sender, Chart.DrawEventArgs<Events.DoubleDrawingData> e) { WPShapes.Line line = new WPShapes.Line(); line.Stroke = _brush; line.StrokeThickness = 2; line.X1 = e.Data.XFrom; line.Y1 = e.Data.YFrom; line.X2 = e.Data.XTo; line.Y2 = e.Data.YTo; this.Children.Add(line); }
public override void Dibujar(MainWindow ventana) { var ln = new Line { X1 = CoordX, Y1 = CoordY, X2 = CoordX2, Y2 = CoordY2, Stroke = Brushes.Black, FlowDirection = System.Windows.FlowDirection.RightToLeft, StrokeThickness = 5 }; ventana.Dibujador.Children.Add(ln); }
void initLine(Color c) { line = new Line(); line.Stroke = new SolidColorBrush(c); line.StrokeThickness = ShapeUtils.LINE_WIDTH; line.Effect = ShapeUtils.ShadowProvider(); line.Tag = this; selMarker1 = ShapeUtils.MakeMarker(); selMarker1.Tag = this; selMarker2 = ShapeUtils.MakeMarker(); selMarker2.Tag = this; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/311NYC;component/AboutPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.About311 = ((System.Windows.Controls.Grid)(this.FindName("About311"))); this.textBlock1 = ((System.Windows.Controls.TextBlock)(this.FindName("textBlock1"))); this.hyperlinkButton1 = ((System.Windows.Controls.HyperlinkButton)(this.FindName("hyperlinkButton1"))); this.hyperlinkButton2 = ((System.Windows.Controls.HyperlinkButton)(this.FindName("hyperlinkButton2"))); this.line1 = ((System.Windows.Shapes.Line)(this.FindName("line1"))); this.line2 = ((System.Windows.Shapes.Line)(this.FindName("line2"))); }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/5-Ruler;component/MainPage.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.RulerCanvas = ((System.Windows.Controls.Canvas)(this.FindName("RulerCanvas"))); this.ExactMeasurementLine = ((System.Windows.Shapes.Line)(this.FindName("ExactMeasurementLine"))); this.ButtonsCanvas = ((System.Windows.Controls.Canvas)(this.FindName("ButtonsCanvas"))); this.LeftOrRightBtn = ((System.Windows.Controls.Button)(this.FindName("LeftOrRightBtn"))); this.LeftBtn = ((System.Windows.Controls.Primitives.RepeatButton)(this.FindName("LeftBtn"))); this.ExactMeasurementTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("ExactMeasurementTextBlock"))); }
public DimensionPainter(Canvas canvas) { _canvas = canvas; _canvas.Children.Add(_pointerLine = new Line { X1 = 0, Y1 = 0, X2 = 0, Y2 = height, Stroke = new SolidColorBrush(Color.FromArgb(0x77, 0xFF, 0, 0)), StrokeThickness = 1 }); }
void draw_axis(Point start, Point end) { var line = new Line(); line.X1 = start.X; line.Y1 = start.Y; line.X2 = end.X; line.Y2 = end.Y; line.Stroke = Brushes.Black; line.StrokeThickness = 1; line.SnapsToDevicePixels = true; line.SetValue(RenderOptions.EdgeModeProperty, EdgeMode.Aliased); canvas.Children.Add(line); }
private void Canvas1_TouchDown(object sender, TouchEventArgs e) { var pt = e.GetTouchPoint(Canvas1); // 縦線を作ります。 var lineV = new Line(); lineV.X1 = lineV.X2 = pt.Position.X; lineV.Y1 = 0; lineV.Y2 = ActualHeight; lineV.Stroke = Brushes.Red; Canvas1.Children.Add(lineV); lineVList[e.TouchDevice] = lineV; // 横線を作ります。 var lineH = new Line(); lineH.X1 = 0; lineH.X2 = ActualWidth; lineH.Y1 = lineH.Y2 = pt.Position.Y; lineH.Stroke = Brushes.Red; Canvas1.Children.Add(lineH); lineHList[e.TouchDevice] = lineH; // 円を作ります。 var ellipse = new Ellipse(); ellipse.Width = 50; ellipse.Height = 50; ellipse.Fill = Brushes.Blue; ellipse.RenderTransform = new TranslateTransform(pt.Position.X - ellipse.RenderSize.Width / 2, pt.Position.Y - ellipse.RenderSize.Height / 2); Canvas1.Children.Add(ellipse); ellipseList[e.TouchDevice] = ellipse; // idを表すラベルを作ります。 var label = new Label(); label.Foreground = Brushes.White; label.FontSize = 36; label.Content = e.TouchDevice.Id; label.RenderTransform = new TranslateTransform(pt.Position.X - label.RenderSize.Width / 2, pt.Position.Y - label.RenderSize.Height / 2); Canvas1.Children.Add(label); labelList[e.TouchDevice] = label; Canvas1.InvalidateVisual(); Canvas1.CaptureTouch(e.TouchDevice); }
public void AddToCanvas(Canvas canvas) { var flowMidPoint = new Point().AsMidPointOf(_sourceStock.MidPoint, _targetStock.MidPoint); _sourceLine = new Line().FromPoints(_sourceStock.MidPoint, flowMidPoint, Brushes.LawnGreen); _targetLine = new Line().FromPoints(flowMidPoint, _targetStock.MidPoint, Brushes.LawnGreen); var flowRectangle = new Rectangle { Stroke = Brushes.Black, Fill = Brushes.PaleTurquoise }; MakeDraggable(flowRectangle, relativeTo: canvas); MouseDrag += OnMouseDragHandler; canvas.Children.Add(_sourceLine); canvas.Children.Add(_targetLine); canvas.Children.Add(flowRectangle.FromMidPoint(flowMidPoint, Width, Height)); }
void ContentPanelCanvas_MouseMove(object sender, MouseEventArgs e) { CurrentPoint = e.GetPosition(ContentPanelCanvas); var line = new Line { X1 = CurrentPoint.X, Y1 = CurrentPoint.Y, X2 = PreviousPoint.X, Y2 = PreviousPoint.Y, Stroke = CurrentBrush, StrokeThickness = PenWidth }; ContentPanelCanvas.Children.Add(line); PreviousPoint = CurrentPoint; }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/PDIS;component/settings.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.ContentPanel = ((System.Windows.Controls.Grid)(this.FindName("ContentPanel"))); this.startButton = ((System.Windows.Controls.Button)(this.FindName("startButton"))); this.stopButton = ((System.Windows.Controls.Button)(this.FindName("stopButton"))); this.xTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("xTextBlock"))); this.yTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("yTextBlock"))); this.zTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("zTextBlock"))); this.xLine = ((System.Windows.Shapes.Line)(this.FindName("xLine"))); this.yLine = ((System.Windows.Shapes.Line)(this.FindName("yLine"))); this.zLine = ((System.Windows.Shapes.Line)(this.FindName("zLine"))); this.statusTextBlock = ((System.Windows.Controls.TextBlock)(this.FindName("statusTextBlock"))); }
public BezierSegmentFrame(UIElement child, PathFigure fig, BezierSegment bez) : base(child) { bezier = bez; figure = fig; previous = null; foreach (PathSegment segment in figure.Segments) { BezierSegment bs = segment as BezierSegment; if (segment == bezier) break; previous = segment; } point1_line = CreateLine(); point2_line = CreateLine(); }
/// <summary> /// Creates a vertical dotted line to separate the line numbers from the text view. /// </summary> public static UIElement Create() { Line line = new Line { X1 = 0, Y1 = 0, X2 = 0, Y2 = 1, StrokeDashArray = { 0, 2 }, Stretch = Stretch.Fill, StrokeThickness = 1, StrokeDashCap = PenLineCap.Round, Margin = new Thickness(2, 0, 2, 0), Tag = tag }; return line; }
private void ShowHelperLines() { for (var octave = Note.Octave.Great; octave <= Note.Octave.ThreeLined; octave++) { var note = new Note(Note.Letter.C, Note.Accidental.None, octave); var staffPosition = note.ToStaffPosition(type, false); if (note.staffType != type) continue; double y = StaffPositionToY(staffPosition); // Rysuję linie pomocniczą. Line helperLine = new Line { X1 = left, X2 = score.ActualWidth - marginLeft, Y1 = y, Y2 = y, Stroke = helperLineBrush, StrokeThickness = 0.4 }; score.Children.Add(helperLine); // Rusuje nazwę oktawy. const string familyName = "Consolas"; double fontSize = 9 * score.Magnification; FormattedText formattedText = new FormattedText( octave.ToString(), CultureInfo.GetCultureInfo("en-us"), FlowDirection.LeftToRight, new Typeface(familyName), fontSize, Brushes.Black); TextBlock octaveNameTextBlock = new TextBlock { FontFamily = new FontFamily(familyName), FontSize = fontSize, Text = octave.ToString(), Foreground = helperLineBrush, Padding = new Thickness(0, 0, 0, 0), Margin = new Thickness(helperLine.X1, helperLine.Y1 - formattedText.Height/* + formattedText.OverhangAfter - formattedText.Extent*/, 0, 0) }; score.Children.Add(octaveNameTextBlock); //Canvas.SetZIndex(octaveNameTextBlock, 1); } }
private void ShowLines() { for (var staffPosition = StaffPosition.ByLine(1); staffPosition <= StaffPosition.ByLine(5); staffPosition.AddLine(1)) { double y = StaffPositionToY(staffPosition); Line shapeLine = new Line { X1 = left, X2 = score.ActualWidth - marginLeft, Y1 = y, Y2 = y, Stroke = Brushes.Black, StrokeThickness = 1 }; score.Children.Add(shapeLine); } }
public void InitializeComponent() { if (_contentLoaded) { return; } _contentLoaded = true; System.Windows.Application.LoadComponent(this, new System.Uri("/PlanMyWay;component/UserControlPMW/FlecheBasInfo.xaml", System.UriKind.Relative)); this.LayoutRoot = ((System.Windows.Controls.Grid)(this.FindName("LayoutRoot"))); this.tb_SubjectRdv = ((System.Windows.Controls.TextBlock)(this.FindName("tb_SubjectRdv"))); this.tb_AdrRdv = ((System.Windows.Controls.TextBlock)(this.FindName("tb_AdrRdv"))); this.ContentPanelCanvas = ((System.Windows.Controls.Canvas)(this.FindName("ContentPanelCanvas"))); this.MyLine = ((System.Windows.Shapes.Line)(this.FindName("MyLine"))); this.maFleche = ((System.Windows.Shapes.Polygon)(this.FindName("maFleche"))); this.tb_Distance = ((System.Windows.Controls.TextBlock)(this.FindName("tb_Distance"))); this.tb_DistanceInfo = ((System.Windows.Controls.TextBlock)(this.FindName("tb_DistanceInfo"))); this.tb_Conso = ((System.Windows.Controls.TextBlock)(this.FindName("tb_Conso"))); this.tb_ConsoInfo = ((System.Windows.Controls.TextBlock)(this.FindName("tb_ConsoInfo"))); this.tb_TpsTrajet = ((System.Windows.Controls.TextBlock)(this.FindName("tb_TpsTrajet"))); this.tb_TpsTrajetInfo = ((System.Windows.Controls.TextBlock)(this.FindName("tb_TpsTrajetInfo"))); this.tb_Cout = ((System.Windows.Controls.TextBlock)(this.FindName("tb_Cout"))); this.tb_CoutInfo = ((System.Windows.Controls.TextBlock)(this.FindName("tb_CoutInfo"))); }
public static void RefreshRelationShipPosition( LinkDefinition linkDefinition, Dictionary<TableDefinition, TableDefinitionControl> tableDefinitionControls, Canvas modelViewerContainer, Line line) { var sourceTableDefinition = linkDefinition.Source.TableDefinition; var targetTableDefinition = linkDefinition.Target.TableDefinition; var sourceTableDefinitionControl = tableDefinitionControls[sourceTableDefinition]; var targetTableDefinitionControl = tableDefinitionControls[targetTableDefinition]; var sourceCenterPoint = CalculateTableDefinitionControlCenterPoint(sourceTableDefinitionControl); var targetCenterPoint = CalculateTableDefinitionControlCenterPoint(targetTableDefinitionControl); var sourceTableCoordinateX = Canvas.GetLeft(sourceTableDefinitionControl); var targetTableCoordinateX = Canvas.GetLeft(targetTableDefinitionControl); var sourceTableCoordinateY = Canvas.GetTop(sourceTableDefinitionControl); var targetTableCoordinateY = Canvas.GetTop(targetTableDefinitionControl); line.X1 = sourceTableCoordinateX + sourceCenterPoint.X; line.X2 = targetTableCoordinateX + targetCenterPoint.X; line.Y1 = sourceTableCoordinateY + sourceCenterPoint.Y; line.Y2 = targetTableCoordinateY + targetCenterPoint.Y; }
private void MainCanvas_MouseMove(object sender, MouseEventArgs e) { if (delList == null) { delList = new List<Line>(); } if (e.LeftButton != MouseButtonState.Pressed) return; var line = new Line { Stroke = SystemColors.WindowFrameBrush, StrokeThickness = MapController.StrokeSize, X1 = _currentPoint.X, Y1 = _currentPoint.Y, X2 = e.GetPosition(_mainCanvas).X, Y2 = e.GetPosition(_mainCanvas).Y }; _currentPoint = e.GetPosition(_mainCanvas); polyline.Points.Add(_currentPoint); _mainCanvas.Children.Add(line); delList.Add(line); }