VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects Namespace / WpfGraphicObjectTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс WpfGraphicObjectTool
    В этом разделе
    Визуальный инструмент для отображения статических графических объектов в просмотрщике изображений.
    Объектная модель
    IObjectClipboard IWpfInteractionController WpfImageViewer WpfGraphicObjectTool
    Синтаксис
    'Declaration
    
    <DesignTimeVisibleAttribute("Visible = False")>
    <ToolboxItemAttribute("ToolboxItemType = null", "ToolboxItemTypeName = ")>
    <DefaultPropertyAttribute("Content")>
    <ContentPropertyAttribute("Content")>
    <LocalizabilityAttribute(None)>
    <StyleTypedPropertyAttribute("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")>
    <XmlLangPropertyAttribute("Name = Language")>
    <UsableDuringInitializationAttribute("Usable = True")>
    <RuntimeNamePropertyAttribute("Name = Name")>
    <UidPropertyAttribute()>
    <TypeDescriptionProviderAttribute("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")>
    <NameScopePropertyAttribute("Name = NameScope", "Type = System.Windows.NameScope")>
    Public Class WpfGraphicObjectTool
       Inherits Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public class WpfGraphicObjectTool : Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public __gc class WpfGraphicObjectTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool*
    
    
    [DesignTimeVisible("Visible = False")]
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DefaultProperty("Content")]
    [ContentProperty("Content")]
    [Localizability(None)]
    [StyleTypedProperty("Property = FocusVisualStyle", "StyleTargetType = System.Windows.Controls.Control")]
    [XmlLangProperty("Name = Language")]
    [UsableDuringInitialization("Usable = True")]
    [RuntimeNameProperty("Name = Name")]
    [UidProperty()]
    [TypeDescriptionProvider("TypeName = MS.Internal.ComponentModel.DependencyObjectProvider")]
    [NameScopeProperty("Name = NameScope", "Type = System.Windows.NameScope")]
    public ref class WpfGraphicObjectTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool^
    
    
    Пример

    Вот C#/VB.NET код, который демонстрирует, как нарисовать два графических объекта в просмотрщике: первый объект - прямоугольник (красный), который использует систему координат текущего изображения, второй объект - эллипс (зеленый), который использует систему координат просмотрщика изображений:

    
    ''' <summary>
    ''' Tests the graphics objects on image viewer.
    ''' </summary>
    ''' <param name="viewer">The viewer.</param>
    Public Shared Sub TestGraphicsObjects(viewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer)
        ' objects location and size
        Dim objectBBox As New System.Windows.Rect(40, 60, 80, 100)
    
        ' object fill brush
        Dim brush As System.Windows.Media.Brush = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(128, 255, 255, 255))
    
        ' create Rectangular Graphic Object
        Dim rect As New Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfRectangularGraphicObject(objectBBox, New System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 10), brush)
        ' use current image coordinate space for rectange
        rect.PointTransform = New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfPixelsToImageViewerPointTransform()
    
        ' create Elliptical Graphic Object
        Dim ellipse As New Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfEllipticalGraphicObject(objectBBox, New System.Windows.Media.Pen(System.Windows.Media.Brushes.Green, 10), brush)
        ' use image viewer coordinate space for ellipse
        ellipse.PointTransform = Nothing
    
        ' create GraphicObjectTool
        Dim graphicObjects As New Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfGraphicObjectTool()
        graphicObjects.GraphicObjectCollection.Add(rect)
        graphicObjects.GraphicObjectCollection.Add(ellipse)
    
        ' set GraphicObjectTool as current tool of ImageViewer
        viewer.VisualTool = graphicObjects
    End Sub
    
    
    
    /// <summary>
    /// Tests the graphics objects on image viewer.
    /// </summary>
    /// <param name="viewer">The viewer.</param>
    public static void TestGraphicsObjects(Vintasoft.Imaging.Wpf.UI.WpfImageViewer viewer)
    {
        // objects location and size
        System.Windows.Rect objectBBox = new System.Windows.Rect(40, 60, 80, 100);
    
        // object fill brush
        System.Windows.Media.Brush brush = 
            new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(128, 255, 255, 255));
    
        // create Rectangular Graphic Object
        Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfRectangularGraphicObject rect = 
            new Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfRectangularGraphicObject(
                objectBBox, new System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 10), brush);
        // use current image coordinate space for rectange
        rect.PointTransform = new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfPixelsToImageViewerPointTransform();
    
        // create Elliptical Graphic Object
        Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfEllipticalGraphicObject ellipse = 
            new Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfEllipticalGraphicObject(
                objectBBox, new System.Windows.Media.Pen(System.Windows.Media.Brushes.Green, 10), brush);
        // use image viewer coordinate space for ellipse
        ellipse.PointTransform = null;
    
        // create GraphicObjectTool
        Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfGraphicObjectTool graphicObjects = 
            new Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfGraphicObjectTool();
        graphicObjects.GraphicObjectCollection.Add(rect);
        graphicObjects.GraphicObjectCollection.Add(ellipse);
    
        // set GraphicObjectTool as current tool of ImageViewer
        viewer.VisualTool = graphicObjects;
    }
    
    

    Иерархия наследования

    System.Object
       System.Windows.Threading.DispatcherObject
          System.Windows.DependencyObject
             System.Windows.Media.Visual
                System.Windows.UIElement
                   System.Windows.FrameworkElement
                      System.Windows.Controls.Control
                         System.Windows.Controls.ContentControl
                            Vintasoft.Imaging.Wpf.UI.VisualTools.WpfVisualTool
                               Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
                                  Vintasoft.Imaging.Wpf.UI.VisualTools.GraphicObjects.WpfGraphicObjectTool
                                     Vintasoft.Imaging.Wpf.UI.VisualTools.WpfTextOverlayTool

    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также