アノテーションオブジェクトのサイズを指定して追加するには?
対象製品
LEADTOOLS 17.5J Document Imaging
詳細
長方形、楕円、テキスト、ハイライト、スタンプオブジェクトなどはBoundsプロパティでデフォルトの表示サイズを設定できます。
サンプルコード(VB.NET)
サンプルコード(C#)
実際の動作はSP1で追加された製品のチュートリアル「SetAnnotationSize」をご覧ください。
サンプルコード(VB.NET)
' 自動モードの管理に使用するAutomationManager Private annAutomationManager As AnnAutomationManager Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load ' RasterCodecsオブジェクトを初期化します。 Dim codecs As RasterCodecs = New RasterCodecs ' メイン画像をビューワにロードします。 RasterImageViewer1.Image = codecs.Load("sample2.cmp") ' AutomationManagerを作成して設定します。 annAutomationManager = New AnnAutomationManager ' コンテナを設定します。 Dim automation As AnnAutomation = New AnnAutomation(annAutomationManager, RasterImageViewer1) ' このAutomationをアクティブなAutomationに設定します。 automation.Active = True End Sub Private Sub RasterImageViewer1_MouseClick(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles RasterImageViewer1.MouseClick ' ゴムスタンプの種類と大きさを設定します。 Dim stamp As AnnRubberStampObject = New AnnRubberStampObject stamp.Bounds = New AnnRectangle(e.X, e.Y, 200, 100, AnnUnit.Pixel) stamp.Type = AnnRubberStampType.Important ' コンテナにゴムスタンプを追加します。 annAutomationManager.Automations.Item(0).Container.Objects.Add(stamp) RasterImageViewer1.Invalidate() End Sub
サンプルコード(C#)
// 自動モードの管理に使用するAutomationManager private AnnAutomationManager annAutomationManager; private void Form1_Load(object sender, EventArgs e) { // RasterCodecsオブジェクトを初期化します。 RasterCodecs codecs = new RasterCodecs(); // メイン画像をビューワにロードします。 rasterImageViewer1.Image = codecs.Load(@"sample2.cmp"); // AutomationManagerを作成して設定します。 annAutomationManager = new AnnAutomationManager(); // コンテナを設定します。 AnnAutomation automation = new AnnAutomation(annAutomationManager, rasterImageViewer1); // このAutomationをアクティブなAutomationに設定します。 automation.Active = true; } private void rasterImageViewer1_MouseClick(object sender, MouseEventArgs e) { // ゴムスタンプの種類と大きさを設定します。 AnnRubberStampObject stamp = new AnnRubberStampObject(); stamp.Bounds = new AnnRectangle(e.X, e.Y, 200, 100, AnnUnit.Pixel); stamp.Type = AnnRubberStampType.Important; // コンテナにゴムスタンプを追加します。 annAutomationManager.Automations[0].Container.Objects.Add(stamp); rasterImageViewer1.Invalidate(); }
実際の動作はSP1で追加された製品のチュートリアル「SetAnnotationSize」をご覧ください。
関連情報
- アノテーションオブジェクトを別々のコンテナに保存するには?
- 非自動アノテーションオブジェクトを画像に描画するには?
- 選択しているアノテーションオブジェクトのみを画像に描画するには?
- アノテーションの削除を検知できるイベントはありますか?
キーワード
HowTo アノテーション