PrintDocument for WinForms
DoEvents プロパティ (C1MultiDocument)
使用例 


C1.PrintDocument.6 アセンブリ > C1.C1Preview 名前空間 > C1MultiDocument クラス : DoEvents プロパティ
Gets or sets a value indicating whether the current C1MultiDocument should handle Windows messages while generating.

The default value is false.

シンタックス
'宣言
 
Public Property DoEvents As System.Boolean
'使用法
 
Dim instance As C1MultiDocument
Dim value As System.Boolean
 
instance.DoEvents = value
 
value = instance.DoEvents
public System.bool DoEvents {get; set;}
解説

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.

使用例

The code below implements "Generate" and "Cancel" buttons attached to a 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 C1MultiDocument.Generate method while the component is busy throws an exception.)

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

_doc.DoEvents = true;
            
private void Generate_Click(object sender, EventArgs e)
{
   if (_doc.BusyState != BusyStateEnum.Ready)
       Console.WriteLine("Cannot generate now, document is busy");
   else 
       _doc.Generate();
}
private void Cancel_Click(object sender, EventArgs e) 
{
   if (_doc.BusyState != BusyStateEnum.Ready) 
       _doc.Cancel = true;
   else 
       Console.WriteLine("Document is not generating, nothing to cancel");
}
参照

C1MultiDocument クラス
C1MultiDocument メンバ