スキャンラインデリゲート
Namespace: FVIL.FileAssembly: FVILbasic (in FVILbasic.dll) Version: 3.1.0.0 (3.1.0.17)
Syntax
C# |
---|
public delegate bool ScanLineDelegate( Object param, double Percentage ) |
Visual Basic |
---|
Public Delegate Function ScanLineDelegate ( param As Object, Percentage As Double ) As Boolean |
Parameters
- param
- Type: System..::..Object
任意のパラメータ
- Percentage
- Type: System..::..Double
進行状況 (0~100)
Return Value
Type: Boolean継続する場合は true を返します。中断する場合は false を返します。
Remarks
通常は、クラスのメンバ関数を登録します。
C# の場合は、スタティック関数でなければ登録する事ができないので、
関数の所有者も指定する必要があります。
Examples
下記に登録例を示します。
C# | Copy |
---|---|
public class CMyClass { // // 引数に指定された画像ファイルを画像オブジェクトに読み込んで返します。 // public FVIL.Data.CFviImage LoadImageFile( System.String filename ) { FVIL.File.CFviImageFileBmp filer = new FVIL.File.CFviImageFileBmp(); FVIL.Data.CFviImage image = new FVIL.Data.CFviImage(); // 進行状況の通知を受ける _progress 関数を登録します。 // ScanLineParam に指定したパラメータは、_progress 関数の第一引数に渡されます。 filer.ScanLineHandler = new FVIL.File.ScanLineDelegate(CMyClass._progress); filer.ScanLineParam = this; // 画像ファイルの読み込みを実行します。 // 読み込みが完了するまで制御が戻りませんが、 // 上記で登録した _progress 関数は定期的に呼び出されます。 filer.Load( filename, image ); return image; } // // 呼び出し元が、この関数を定期的に呼び出し、進行状況を通知します。 // 引数 owner を自身の型にキャストして、メンバフィールドをアクセスしています。 // // [i/ ] owner : ScanLineParam に設定したパラメータが渡されます。 // [i/ ] percentage : 進行状況(0~100)が渡されます。 // public static bool _progress( System.Object owner, double percentage ) { CMyClass _this = (CMyClass)owner; _this.Percentage = percentage; return !(_this.m_interrupt); // true:継続、false:中断 } public Property double Percentage; // // 処理を中断するよう指示します。 // 次回、_progress 関数が false を返し、CFviImageFileBmp は処理を中断します。 // public void Stop() { m_interrupt = true; // 中断 } protected bool m_interrupt; }; |