combit List & Label 26 - .NET Help
combit.Reporting Namespace / ListLabelPreviewControl Class
Members


In This Topic
    ListLabelPreviewControl Class
    In This Topic
    The preview control displays List & Label preview files. The control also allows export to other formats like PDF or Multi-TIFF.
    Object Model
    ListLabelPreviewControl ClassListLabelPreviewControl.PreviewPageStyle ClassListLabelPreviewControl.PreviewSelectionFrame ClassListLabelPreviewButtons ClassListLabelPreviewControl.PreviewZoomStyle Class
    Syntax
    'Declaration
     
    
    Public Class ListLabelPreviewControl 
       Inherits System.Windows.Forms.Control
    public class ListLabelPreviewControl : System.Windows.Forms.Control 
    public ref class ListLabelPreviewControl : public System.Windows.Forms.Control 
    Remarks

    Automatic saving of form data

    In order to achieve an automatic saving of the contents of any form elements on exit/close, you must ensure that the host calls the PreviewControl's CanClose Method. A very good time for example in WinForms would be the FormClosing event. Otherwise, saving the input form data is not forced.

                                    
    private void DoPreviewPrint()
    {   
        // Create and use List & Label object
        using (ListLabel LL = new ListLabel())
        {
            // Define/Assign data source
            LL.DataSource = CreateDataSet();
           
            // Bind preview control to the List & Label object
            LL.PreviewControl = LLPreviewControl;
           
            // Set print mode to preview control
            LL.AutoDestination = LlPrintMode.PreviewControl;
           
            // Prevent opening the resulting XML file with formular data
            LL.ExportOptions.Clear();
            LL.ExportOptions.Add(LlExportOption.ExportShowResult, "0");
           
            // Register event to define project parameters for autoamtically and silently saving formular data
            LL.DefinePrintOptions += new DefinePrintOptionsHandler(LL_DefinePrintOptions);
           
            // Print
            LL.Print();
        }
    }
    
    void LL_DefinePrintOptions(object sender, EventArgs e)
    {
        // Get the calling List & Label object
        ListLabel localLL = sender as ListLabel;
       
        // Define project parameters for autoamtically and silently saving formular data
        localLL.ProjectParameters[LlProjectParameter.SaveAsFormat].Value = "XML";
        localLL.ProjectParameters[LlProjectParameter.SaveAsFilename].Value = @"C:\temp\myFormData.xml";
        localLL.ProjectParameters[LlProjectParameter.SaveAsNoSaveQuery].Value = "1";
        localLL.ProjectParameters[LlProjectParameter.SaveAsShowDialog].Value = "0";
    }
    
    private void Form1_FormClosing(object sender, FormClosingEventArgs e)
    {
        // Be sure the formular data become saved
        if (LL.Core.IsPrinting || !LLPreviewControl.CanClose())
            e.Cancel = true;
    }
    
                    
    
    Private Sub DoPreviewPrint()
        ' Create and use List & Label object
        Using LL As New ListLabel()
            ' Define/Assign data source
            LL.DataSource = CreateDataSet()
            ' Bind preview control to the List & Label object
            LL.PreviewControl = LLPreviewControl
            ' Set print mode to preview control
            LL.AutoDestination = LlPrintMode.PreviewControl
            ' Prevent opening the resulting XML file with formular data
            LL.ExportOptions.Clear()
            LL.ExportOptions.Add(LlExportOption.ExportShowResult, "0")
            ' Register event to define project parameters for autoamtically and silently saving formular data
            AddHandler LL.DefinePrintOptions, AddressOf LL_DefinePrintOptions
            ' Print
            LL.Print()
        End Using
    End Sub
    
    Private Sub LL_DefinePrintOptions(sender As Object, e As EventArgs)
        ' Get the calling List & Label object
        Dim localLL As ListLabel = TryCast(sender, ListLabel)
        ' Define project parameters for autoamtically and silently saving formular data
        localLL.ProjectParameters(LlProjectParameter.SaveAsFormat).Value = "XML"
        localLL.ProjectParameters(LlProjectParameter.SaveAsFilename).Value = "C:\temp\myFormData.xml"
        localLL.ProjectParameters(LlProjectParameter.SaveAsNoSaveQuery).Value = "1"
        localLL.ProjectParameters(LlProjectParameter.SaveAsShowDialog).Value = "0"
    End Sub
    
    Private Sub Form1_FormClosing(sender As Object, e As FormClosingEventArgs)
        ' Be sure the formular data become saved
        If LL.Core.IsPrinting OrElse Not LLPreviewControl.CanClose() Then
            e.Cancel = True
        End If
    End Sub
    

     

    Inheritance Hierarchy

    System.Object
       System.MarshalByRefObject
          System.ComponentModel.Component
             System.Windows.Forms.Control
                combit.Reporting.ListLabelPreviewControl

    Requirements

    Platforms: Windows 8.1 bis Windows 10 Version 1803 - 20H2, Windows Server 2012 bis 2019

    See Also