
'Declaration Public Class WpfFormFieldTemplateEditorTool Inherits Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
public class WpfFormFieldTemplateEditorTool : Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
public __gc class WpfFormFieldTemplateEditorTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
public ref class WpfFormFieldTemplateEditorTool : public Vintasoft.Imaging.Wpf.UI.VisualTools.UserInteraction.WpfUserInteractionVisualTool
Class WpfFormFieldTemplateEditorToolWindow Inherits System.Windows.Window Private imageViewer1 As Vintasoft.Imaging.Wpf.UI.WpfImageViewer Private buildFieldTemplateButton As System.Windows.Controls.Button ' ... ''' <summary> ''' Form template manager. ''' </summary> Private _templateManager As Vintasoft.Imaging.FormsProcessing.FormRecognition.FormTemplateManager ''' <summary> ''' The template editor tool. ''' </summary> Private _templateEditorTool As Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.VisualTools.WpfFormFieldTemplateEditorTool ' ... Public Sub New() ' ... _templateEditorTool = New Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.VisualTools.WpfFormFieldTemplateEditorTool() imageViewer1.VisualTool = _templateEditorTool AddHandler imageViewer1.FocusedIndexChanged, New Vintasoft.Imaging.PropertyChangedEventHandler(Of Integer)(AddressOf imageViewer1_FocusedIndexChanged) ' ... AddHandler buildFieldTemplateButton.Click, New System.Windows.RoutedEventHandler(AddressOf buildFieldTemplateButton_Click) End Sub ''' <summary> ''' Handles the FocusedIndexChanged event of the imageViewer1 ''' to change the collection of form field templates of the visual tool. ''' </summary> Private Sub imageViewer1_FocusedIndexChanged(sender As Object, e As Vintasoft.Imaging.PropertyChangedEventArgs(Of Integer)) If imageViewer1.Image Is Nothing Then _templateEditorTool.FieldTemplateCollection = Nothing Else ' get the form page template Dim pageTemplate As Vintasoft.Imaging.FormsProcessing.FormRecognition.FormPageTemplate = _templateManager.GetPageTemplate(imageViewer1.Image) ' set items of page template as current items of the visual tool _templateEditorTool.FieldTemplateCollection = pageTemplate.Items End If End Sub ' ... ''' <summary> ''' Handles the Click event of the buildFieldTemplateButton ''' to create a form field template and start building of it. ''' </summary> Private Sub buildFieldTemplateButton_Click(sender As Object, e As System.Windows.RoutedEventArgs) ' create an OMR rectangular field template Dim fieldTemplate As Vintasoft.Imaging.FormsProcessing.FormRecognition.FormFieldTemplate = New Vintasoft.Imaging.FormsProcessing.FormRecognition.Omr.OmrRectangularFieldTemplate() ' create a view for the field template Dim fieldTemplateView As Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.WpfFormFieldTemplateView = Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.WpfFormFieldTemplateViewFactory.CreateView(fieldTemplate) ' add field template to the collection of visual tool and ' start building of field template _templateEditorTool.AddAndBuild(fieldTemplateView) End Sub ' ... End Class
class WpfFormFieldTemplateEditorToolWindow : System.Windows.Window { Vintasoft.Imaging.Wpf.UI.WpfImageViewer imageViewer1; System.Windows.Controls.Button buildFieldTemplateButton; // ... /// <summary> /// Form template manager. /// </summary> Vintasoft.Imaging.FormsProcessing.FormRecognition.FormTemplateManager _templateManager; /// <summary> /// The template editor tool. /// </summary> Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.VisualTools.WpfFormFieldTemplateEditorTool _templateEditorTool; // ... public WpfFormFieldTemplateEditorToolWindow() { // ... _templateEditorTool = new Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.VisualTools.WpfFormFieldTemplateEditorTool(); imageViewer1.VisualTool = _templateEditorTool; imageViewer1.FocusedIndexChanged += new Vintasoft.Imaging.PropertyChangedEventHandler<int>(imageViewer1_FocusedIndexChanged); buildFieldTemplateButton.Click += new System.Windows.RoutedEventHandler(buildFieldTemplateButton_Click); // ... } /// <summary> /// Handles the FocusedIndexChanged event of the imageViewer1 /// to change the collection of form field templates of the visual tool. /// </summary> private void imageViewer1_FocusedIndexChanged( object sender, Vintasoft.Imaging.PropertyChangedEventArgs<int> e) { if (imageViewer1.Image == null) { _templateEditorTool.FieldTemplateCollection = null; } else { // get the form page template Vintasoft.Imaging.FormsProcessing.FormRecognition.FormPageTemplate pageTemplate = _templateManager.GetPageTemplate(imageViewer1.Image); // set items of page template as current items of the visual tool _templateEditorTool.FieldTemplateCollection = pageTemplate.Items; } } // ... /// <summary> /// Handles the Click event of the buildFieldTemplateButton /// to create a form field template and start building of it. /// </summary> private void buildFieldTemplateButton_Click(object sender, System.Windows.RoutedEventArgs e) { // create an OMR rectangular field template Vintasoft.Imaging.FormsProcessing.FormRecognition.FormFieldTemplate fieldTemplate = new Vintasoft.Imaging.FormsProcessing.FormRecognition.Omr.OmrRectangularFieldTemplate(); // create a view for the field template Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.WpfFormFieldTemplateView fieldTemplateView = Vintasoft.Imaging.FormsProcessing.FormRecognition.Wpf.UI.WpfFormFieldTemplateViewFactory.CreateView(fieldTemplate); // add field template to the collection of visual tool and // start building of field template _templateEditorTool.AddAndBuild(fieldTemplateView); } // ... }
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.FormsProcessing.FormRecognition.Wpf.UI.VisualTools.WpfFormFieldTemplateEditorTool
Target Platforms: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003