protected override void OnRender(DrawingContext drawingContext) { Point actualPoint; Point origin = FreeFormPanel.GetLocation(AdornedElement); Thickness margin = ((FrameworkElement)AdornedElement).Margin; origin.X += margin.Left; origin.Y += margin.Top; foreach (ConnectionPoint connPoint in connectionPoints) { actualPoint = new Point(connPoint.Location.X - origin.X, connPoint.Location.Y - origin.Y); this.DrawConnectionPoint(connPoint, actualPoint, drawingContext); } base.OnRender(drawingContext); }
protected override void OnRender(DrawingContext drawingContext) { const int textCulture = 9; ConnectionPoint trueConnectionPoint = null; ConnectionPoint falseConnectionPoint = null; if (this.connectionPoints.Contains(FlowchartDesigner.GetTrueConnectionPoint(this.AdornedElement))) { trueConnectionPoint = FlowchartDesigner.GetTrueConnectionPoint(this.AdornedElement); } if (this.connectionPoints.Contains(FlowchartDesigner.GetFalseConnectionPoint(this.AdornedElement))) { falseConnectionPoint = FlowchartDesigner.GetFalseConnectionPoint(this.AdornedElement); } Point actualPoint; Point origin = FreeFormPanel.GetLocation(AdornedElement); Thickness margin = ((FrameworkElement)AdornedElement).Margin; origin.X += margin.Left; origin.Y += margin.Top; foreach (ConnectionPoint connPoint in this.connectionPoints) { actualPoint = new Point(connPoint.Location.X - origin.X, connPoint.Location.Y - origin.Y); this.DrawConnectionPoint(connPoint, actualPoint, drawingContext); } if (trueConnectionPoint != null) { string trueLabelText = String.Empty; VirtualizedContainerService.VirtualizingContainer virtualizingContainer = (VirtualizedContainerService.VirtualizingContainer)trueConnectionPoint.ParentDesigner; if (virtualizingContainer != null && virtualizingContainer.ModelItem != null) { trueLabelText = (string)virtualizingContainer.ModelItem.Properties["TrueLabel"].ComputedValue; } actualPoint = new Point(trueConnectionPoint.Location.X - origin.X, trueConnectionPoint.Location.Y - origin.Y); FormattedText trueMarkerFormattedText = new FormattedText(trueLabelText, new System.Globalization.CultureInfo(textCulture), this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize, new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor)); actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2; actualPoint.X -= trueMarkerFormattedText.WidthIncludingTrailingWhitespace; DrawtWithTransform( drawingContext, this.isTextRightToLeft, // Mirror the left side text to the right side by using this axis when RTL. actualPoint.X, () => { drawingContext.DrawText(trueMarkerFormattedText, actualPoint); }); } if (falseConnectionPoint != null) { string falseLabelText = String.Empty; VirtualizedContainerService.VirtualizingContainer virtualizingContainer = (VirtualizedContainerService.VirtualizingContainer)falseConnectionPoint.ParentDesigner; if (virtualizingContainer != null && virtualizingContainer.ModelItem != null) { falseLabelText = (string)virtualizingContainer.ModelItem.Properties["FalseLabel"].ComputedValue; } actualPoint = new Point(falseConnectionPoint.Location.X - origin.X, falseConnectionPoint.Location.Y - origin.Y); actualPoint.Y += ConnectionPoint.DrawingLargeSide / 2; FormattedText falseMarkerFormattedText = new FormattedText(falseLabelText, new System.Globalization.CultureInfo(textCulture), this.FlowDirection, FlowchartDesigner.FlowElementCaptionTypeface, FlowchartDesigner.FlowNodeCaptionFontSize, new SolidColorBrush(WorkflowDesignerColors.WorkflowViewElementCaptionColor)); DrawtWithTransform( drawingContext, this.isTextRightToLeft, // Mirror the left side text to the right side by using this axis when RTL. actualPoint.X, () => { drawingContext.DrawText(falseMarkerFormattedText, actualPoint); }); } base.OnRender(drawingContext); }