// This method establishes a link between current thumb and target thumb using a predefined line geometry // Note: this is commonly to be used for drawing links with mouse when the line object is predefined outside this class public bool LinkTo(PinButton target, LineGeometry line) { // Save as starting line for current thumb this.StartLines.Add(line); // Save as ending line for target thumb target.EndLines.Add(line); // Ensure both tumbs the latest layout this.UpdateLayout(); target.UpdateLayout(); // Update line position line.StartPoint = new Point(Canvas.GetLeft(this) + this.ActualWidth / 2, Canvas.GetTop(this) + this.ActualHeight / 2); line.EndPoint = new Point(Canvas.GetLeft(target) + target.ActualWidth / 2, Canvas.GetTop(target) + target.ActualHeight / 2); return true; }
// This method establishes a link between current thumb and target thumb using a predefined line geometry // Note: this is commonly to be used for drawing links with mouse when the line object is predefined outside this class public bool LinkTo(PinButton target, LineGeometry line) { // Save as starting line for current thumb this.StartLines.Add(line); // Save as ending line for target thumb target.EndLines.Add(line); // Ensure both tumbs the latest layout this.UpdateLayout(); target.UpdateLayout(); // Update line position line.StartPoint = new Point(Canvas.GetLeft(this) + this.ActualWidth / 2, Canvas.GetTop(this) + this.ActualHeight / 2); line.EndPoint = new Point(Canvas.GetLeft(target) + target.ActualWidth / 2, Canvas.GetTop(target) + target.ActualHeight / 2); return(true); }
// This method establishes a link between current thumb and specified thumb. // Returns a line geometry with updated positions to be processed outside. public LineGeometry LinkTo(PinButton target) { // Create new line geometry LineGeometry line = new LineGeometry(); // Save as starting line for current thumb this.StartLines.Add(line); // Save as ending line for target thumb target.EndLines.Add(line); // Ensure both tumbs the latest layout this.UpdateLayout(); target.UpdateLayout(); // Update line position line.StartPoint = new Point(Canvas.GetLeft(this) + this.ActualWidth / 2, ((double.IsNaN(Canvas.GetTop(this))) ? 0 : Canvas.GetTop(this)) + (this.ActualHeight-20)); line.EndPoint = new Point(Canvas.GetLeft(target) + target.ActualWidth / 2, ((double.IsNaN(Canvas.GetTop(target))) ? 0 : Canvas.GetTop(target)) + (target.ActualHeight-20)); // return line for further processing return line; }
// This method establishes a link between current thumb and specified thumb. // Returns a line geometry with updated positions to be processed outside. public LineGeometry LinkTo(PinButton target) { // Create new line geometry LineGeometry line = new LineGeometry(); // Save as starting line for current thumb this.StartLines.Add(line); // Save as ending line for target thumb target.EndLines.Add(line); // Ensure both tumbs the latest layout this.UpdateLayout(); target.UpdateLayout(); // Update line position line.StartPoint = new Point(Canvas.GetLeft(this) + this.ActualWidth / 2, ((double.IsNaN(Canvas.GetTop(this))) ? 0 : Canvas.GetTop(this)) + (this.ActualHeight - 20)); line.EndPoint = new Point(Canvas.GetLeft(target) + target.ActualWidth / 2, ((double.IsNaN(Canvas.GetTop(target))) ? 0 : Canvas.GetTop(target)) + (target.ActualHeight - 20)); // return line for further processing return(line); }