Класс WpfArcAnnotationView
В этом разделе
Определяет, как отображать аннотацию, отображающую дугу.
Объектная модель
Синтаксис
'Declaration
<UidPropertyAttribute()>
<TypeDescriptionProviderAttribute("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")>
<NameScopePropertyAttribute("Name = NameScope", "Type = System.Windows.NameScope")>
Public Class WpfArcAnnotationView
Inherits WpfAnnotationView
Implements IWpfPointBasedAnnotation, IWpfPointBasedInteractiveObject
[UidProperty()]
[TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
[NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
public class WpfArcAnnotationView : WpfAnnotationView, IWpfPointBasedAnnotation, IWpfPointBasedInteractiveObject
[UidProperty()]
[TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
[NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
public __gc class WpfArcAnnotationView : public WpfAnnotationView*, IWpfPointBasedAnnotation, IWpfPointBasedInteractiveObject
[UidProperty()]
[TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
[NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
public ref class WpfArcAnnotationView : public WpfAnnotationView^, IWpfPointBasedAnnotation, IWpfPointBasedInteractiveObject
Пример
Вот C#/VB.NET код, который демонстрирует, как изменить цвет точек начальной и конечной дуги.
''' <summary>
''' Sets the color for first and second points of WPF arc annotation.
''' </summary>
''' <param name="arcAnnotationView">The WPF arc annotation view.</param>
''' <param name="firstArcPointColor">The color of the first point of arc annotation.</param>
''' <param name="secondArcPointColor">The color of the second point of arc annotation.</param>
Public Sub SetInteractionPointsColor(arcAnnotationView As Vintasoft.Imaging.Annotation.Wpf.UI.WpfArcAnnotationView, firstArcPointColor As System.Windows.Media.Color, secondArcPointColor As System.Windows.Media.Color)
If arcAnnotationView Is Nothing Then
Return
End If
SetInteractionPointsColor(arcAnnotationView.InteractionController, firstArcPointColor, secondArcPointColor)
End Sub
''' <summary>
''' Finds the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer"/> and updates
''' the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint.FirstPointFillColor"/> and
''' the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint.SecondPointFillColor"/>.
''' </summary>
''' <param name="interactionController">The interaction controller.</param>
''' <param name="firstArcPointColor">The color of the first point of arc annotation.</param>
''' <param name="secondArcPointColor">The color of the second point of arc annotation.</param>
Private Sub SetInteractionPointsColor(interactionController As Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.IWpfInteractionController, firstArcPointColor As System.Windows.Media.Color, secondArcPointColor As System.Windows.Media.Color)
' if interaction controller is composite interaction controller
If TypeOf interactionController Is Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController Then
Dim compositeInteractionController As Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController = TryCast(interactionController, Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController)
' for each interaction controller in composite interaction controller
For Each item As Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.IWpfInteractionController In compositeInteractionController.Items
SetInteractionPointsColor(item, firstArcPointColor, secondArcPointColor)
Next
End If
' if interaction controller is the point-based annotation point transformer
If TypeOf interactionController Is Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer Then
Dim pointTransformer As Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer = TryCast(interactionController, Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer)
If TypeOf pointTransformer.PolygonPointTemplate Is Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint Then
' get the interactive point that is used for changing the arc annotation
Dim arcTransformationInteractionPoint As Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint = DirectCast(pointTransformer.PolygonPointTemplate, Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint)
' set color of the first point of arc annotation
arcTransformationInteractionPoint.FirstPointFillColor = firstArcPointColor
' set color of the second point of arc annotation
arcTransformationInteractionPoint.SecondPointFillColor = secondArcPointColor
End If
End If
End Sub
/// <summary>
/// Sets the color for first and second points of WPF arc annotation.
/// </summary>
/// <param name="arcAnnotationView">The WPF arc annotation view.</param>
/// <param name="firstArcPointColor">The color of the first point of arc annotation.</param>
/// <param name="secondArcPointColor">The color of the second point of arc annotation.</param>
public void SetInteractionPointsColor(
Vintasoft.Imaging.Annotation.Wpf.UI.WpfArcAnnotationView arcAnnotationView,
System.Windows.Media.Color firstArcPointColor,
System.Windows.Media.Color secondArcPointColor)
{
if (arcAnnotationView == null)
return;
SetInteractionPointsColor(arcAnnotationView.InteractionController, firstArcPointColor, secondArcPointColor);
}
/// <summary>
/// Finds the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer"/> and updates
/// the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint.FirstPointFillColor"/> and
/// the <see cref="Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint.SecondPointFillColor"/>.
/// </summary>
/// <param name="interactionController">The interaction controller.</param>
/// <param name="firstArcPointColor">The color of the first point of arc annotation.</param>
/// <param name="secondArcPointColor">The color of the second point of arc annotation.</param>
private void SetInteractionPointsColor(
Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.IWpfInteractionController interactionController,
System.Windows.Media.Color firstArcPointColor,
System.Windows.Media.Color secondArcPointColor)
{
// if interaction controller is composite interaction controller
if (interactionController is Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController)
{
Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController compositeInteractionController =
interactionController as Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfCompositeInteractionController;
// for each interaction controller in composite interaction controller
foreach (Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.IWpfInteractionController item in compositeInteractionController.Items)
SetInteractionPointsColor(item, firstArcPointColor, secondArcPointColor);
}
// if interaction controller is the point-based annotation point transformer
if (interactionController is Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer)
{
Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer pointTransformer =
interactionController as Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfPointBasedAnnotationPointTransformer;
if (pointTransformer.PolygonPointTemplate is Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint)
{
// get the interactive point that is used for changing the arc annotation
Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint arcTransformationInteractionPoint =
(Vintasoft.Imaging.Annotation.Wpf.UI.VisualTools.UserInteraction.WpfArcTransformationInteractionPoint)pointTransformer.PolygonPointTemplate;
// set color of the first point of arc annotation
arcTransformationInteractionPoint.FirstPointFillColor = firstArcPointColor;
// set color of the second point of arc annotation
arcTransformationInteractionPoint.SecondPointFillColor = secondArcPointColor;
}
}
}
Иерархия наследования
Требования
Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5
Смотрите также