VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Pdf.Wpf.UI Namespace / WpfPdfContentXObjectTool Class
Члены типа Объект Синтаксис Example Иерархия Требования Смотрите также
В этом разделе
    Класс WpfPdfContentXObjectTool
    В этом разделе
    Визуальный инструмент, позволяющий извлекать, выбирать, преобразовывать, заменять или удалять изображения или формы на PDF странице.
    Объектная модель
    DeleteItemUIAction PdfPage WpfImageViewer WpfPdfContentXObjectTool
    Синтаксис
    'Declaration
    
    <ToolboxItemAttribute("ToolboxItemType = null", "ToolboxItemTypeName = ")>
    <DesignTimeVisibleAttribute("Visible = False")>
    <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 WpfPdfContentXObjectTool
       Inherits WpfPdfVisualTool
       Implements ISupportUIActions
    
    
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DesignTimeVisible("Visible = False")]
    [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 WpfPdfContentXObjectTool : WpfPdfVisualTool, ISupportUIActions
    
    
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DesignTimeVisible("Visible = False")]
    [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 WpfPdfContentXObjectTool : public WpfPdfVisualTool*, ISupportUIActions
    
    
    [ToolboxItem("ToolboxItemType = null", "ToolboxItemTypeName = ")]
    [DesignTimeVisible("Visible = False")]
    [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 WpfPdfContentXObjectTool : public WpfPdfVisualTool^, ISupportUIActions
    
    
    Пример

    Вот C#/VB.NET код, который демонстрирует, как выделить сфокусированный XObject в PDF документе, загруженном в просмотрщик изображений.

    
    ''' <summary>
    ''' A window that allows to load PDF document into image viewer and
    ''' highlight focused XObject in PDF document.
    ''' </summary>
    Public Partial Class WindowWithWpfPdfContentXObjectTool
        Inherits System.Windows.Window
        '...
    
        Private _imageViewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer
        Private _contentXObjectTool As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool
    
    
    
        Public Sub New()
            '...
    
            ' create an instance of the WpfPdfContentXObjectTool
            _contentXObjectTool = New Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool()
    
            ' set a pen and brush for image selection
            _contentXObjectTool.SelectionImagesBrush = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 0, 255))
            _contentXObjectTool.SelectionImagesPen = New System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 1)
            ' set a pen and brush for form selection
            _contentXObjectTool.SelectionFormsBrush = New System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 255, 0))
            _contentXObjectTool.SelectionFormsPen = New System.Windows.Media.Pen(System.Windows.Media.Brushes.Blue, 1)
    
            ' subscribe to content XObject tool events
            AddHandler _contentXObjectTool.ContentXObjectMouseEnter, New System.EventHandler(Of Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)(AddressOf ContentXObjectTool_ContentXObjectMouseEnter)
            AddHandler _contentXObjectTool.ContentXObjectMouseLeave, New System.EventHandler(Of Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)(AddressOf ContentXObjectTool_ContentXObjectMouseLeave)
    
            ' set the content XObject tool as current tool
            _imageViewer.VisualTool = _contentXObjectTool
        End Sub
    
    
    
        ''' <summary>
        ''' Occurs when the mouse pointer enters the XObject on PDF page.
        ''' </summary>
        Private Sub ContentXObjectTool_ContentXObjectMouseEnter(sender As Object, e As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)
            ' add the focused XObject to the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Add(e.ContentXObject)
        End Sub
    
        ''' <summary>
        ''' Occurs when the mouse pointer leaves the XObject on PDF page.
        ''' </summary>
        Private Sub ContentXObjectTool_ContentXObjectMouseLeave(sender As Object, e As Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs)
            ' remove focused XObject from the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Remove(e.ContentXObject)
        End Sub
    
    End Class
    
    
    
    /// <summary>
    /// A window that allows to load PDF document into image viewer and
    /// highlight focused XObject in PDF document.
    /// </summary>
    public partial class WindowWithWpfPdfContentXObjectTool : System.Windows.Window
    {
        //...
    
        Vintasoft.Imaging.Wpf.UI.WpfImageViewer _imageViewer;
        Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool _contentXObjectTool;
        
        
        
        public WindowWithWpfPdfContentXObjectTool()
        {
            //...
    
            // create an instance of the WpfPdfContentXObjectTool
            _contentXObjectTool = new Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool();
    
            // set a pen and brush for image selection
            _contentXObjectTool.SelectionImagesBrush = 
                new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 0, 255));
            _contentXObjectTool.SelectionImagesPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Red, 1);
            // set a pen and brush for form selection
            _contentXObjectTool.SelectionFormsBrush = 
                new System.Windows.Media.SolidColorBrush(System.Windows.Media.Color.FromArgb(32, 0, 255, 0));
            _contentXObjectTool.SelectionFormsPen = new System.Windows.Media.Pen(System.Windows.Media.Brushes.Blue, 1);
    
            // subscribe to content XObject tool events
            _contentXObjectTool.ContentXObjectMouseEnter +=
                new System.EventHandler<Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs>(ContentXObjectTool_ContentXObjectMouseEnter);
            _contentXObjectTool.ContentXObjectMouseLeave +=
                new System.EventHandler<Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs>(ContentXObjectTool_ContentXObjectMouseLeave);
    
            // set the content XObject tool as current tool
            _imageViewer.VisualTool = _contentXObjectTool;
        }
    
    
    
        /// <summary>
        /// Occurs when the mouse pointer enters the XObject on PDF page.
        /// </summary>
        private void ContentXObjectTool_ContentXObjectMouseEnter(
            object sender,
            Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs e)
        {
            // add the focused XObject to the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Add(e.ContentXObject);
        }
    
        /// <summary>
        /// Occurs when the mouse pointer leaves the XObject on PDF page.
        /// </summary>
        private void ContentXObjectTool_ContentXObjectMouseLeave(
            object sender,
            Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectEventArgs e)
        {
            // remove focused XObject from the list of focused XObjects
            _contentXObjectTool.SelectedXObjects.Remove(e.ContentXObject);
        }
    
    }
    
    

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

    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.Pdf.Wpf.UI.WpfPdfVisualTool
                                  Vintasoft.Imaging.Pdf.Wpf.UI.WpfPdfContentXObjectTool

    Требования

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

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