PrintDocument for WinForms | ComponentOne
C1.Win.PrintPreview.4.5.2 Assembly / C1.Win.C1Preview.Design Namespace / SampleC1PrintDocument Class / DoEvents Property

In This Topic
    DoEvents Property (SampleC1PrintDocument)
    In This Topic
    Gets or sets a value indicating whether the current C1.C1Preview.C1PrintDocument should handle Windows messages while generating.

    The default value is false.

    Syntax
    'Declaration
     
    Public Property DoEvents As Boolean
    public bool DoEvents {get; set;}
    Remarks

    Setting this property to true allows users to resize forms, click buttons, etc. while documents are being generated. This makes applications more responsive, and is necessary if you want to provide a "Cancel" button to stop the document generation (otherwise the user wouldn't be able to click the button until the generation is complete).

    Setting this property to false will cause documents to generate slightly faster.

    Example

    The code below implements "Generate" and "Cancel" buttons attached to a C1.C1Preview.C1PrintDocument.

    The "Generate" button checks whether the document is busy before starting to generate it. This is necessary because the user could click the "Generate" button several times in a row, before the document got a chance to finish generating. (Calling the C1.C1Preview.C1PrintDocument.Generate method while the component is busy throws an exception.)

    The "Cancel" button checks whether the document is currently generating, and sets the C1.C1Preview.C1PrintDocument.Cancel property to true if it is.

    See Also