VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Wpf.UI.VisualTools Namespace / WpfDragDropSelectionTool Class
    Класс WpfDragDropSelectionTool
    В этом разделе
    Визуальный инструмент для перетаскивания области изображения в просмотрщике изображений.
    Объектная модель
    IWpfInteractionController IWpfInteractionController WpfRectangularObjectTransformer IObjectClipboard WpfImageViewer WpfDragDropSelectionTool
    Синтаксис
    '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 NotInheritable Class WpfDragDropSelectionTool
       Inherits WpfRectangularSelectionTool
    
    
    [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 sealed class WpfDragDropSelectionTool : WpfRectangularSelectionTool
    
    
    [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 __sealed class WpfDragDropSelectionTool : public WpfRectangularSelectionTool*
    
    
    [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 WpfDragDropSelectionTool sealed : public WpfRectangularSelectionTool^
    
    
    Ремарки

    Прямоугольную область изображения в просмотрщике изображений можно перетаскивать следующим образом:

    • поместите мышь в нужную позицию
    • выберите область "перетаскивания" с помощью кнопки действия (ActionButton)
    • нажмите и удерживайте кнопку перетаскивания (DragButton) внутри области "перетаскивания", чтобы начать перетаскивание; нажмите любую кнопку мыши за пределами области "перетаскивания" для отмены перетаскивания области изображения
    • потяните кнопку "Перетаскивание" (DragButton) и перетащите область "перетаскивания"
    • отпустите кнопку "Перетаскивание" (DragButton), когда "перетаскиваемая" область будет перетащена в нужную позицию
    • нажмите кнопку "Отпустить" (DropButton) за пределами области "перетаскивания", чтобы отпустить область; нажмите любую кнопку мыши за пределами области "перетаскивания" для отмены перетаскивания области изображения

    Перетаскиваемая область не изменяется, если нажата клавиша CTRL.

    Пример

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

    
    
    Class WpfDragDropSelectionToolExample
        ' Programmatically drag and drop a region of image.
        Public Sub ProgrammaticallyDragAndDropImageInViewer(viewer As Vintasoft.Imaging.Wpf.UI.WpfImageViewer)
            ' create an instance of the DragDropSelectionTool class
            Dim dragDropSelectionTool As New Vintasoft.Imaging.Wpf.UI.VisualTools.WpfDragDropSelectionTool()
            ' set the tool as the current tool of the ImageViewer
            viewer.VisualTool = dragDropSelectionTool
            ' set the region of interest on image
            dragDropSelectionTool.Rectangle = New System.Windows.Rect(50, 50, 250, 150)
            ' drag and drop the selected region of image to the specified location within the image
            dragDropSelectionTool.DragAndDrop(New System.Windows.Point(200, 250))
        End Sub
    End Class
    
    
    
    
    class WpfDragDropSelectionToolExample
    {
        // Programmatically drag and drop a region of image.
        public void ProgrammaticallyDragAndDropImageInViewer(Vintasoft.Imaging.Wpf.UI.WpfImageViewer viewer)
        {
            // create an instance of the DragDropSelectionTool class
            Vintasoft.Imaging.Wpf.UI.VisualTools.WpfDragDropSelectionTool dragDropSelectionTool =
                new Vintasoft.Imaging.Wpf.UI.VisualTools.WpfDragDropSelectionTool();
            // set the tool as the current tool of the ImageViewer
            viewer.VisualTool = dragDropSelectionTool;
            // set the region of interest on image
            dragDropSelectionTool.Rectangle = new System.Windows.Rect(50, 50, 250, 150);
            // drag and drop the selected region of image to the specified location within the image
            dragDropSelectionTool.DragAndDrop(new System.Windows.Point(200, 250));
        }
    }
    
    

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

    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.WpfRectangularSelectionTool
                                     Vintasoft.Imaging.Wpf.UI.VisualTools.WpfDragDropSelectionTool

    Требования

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

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