Leadtools.Annotations Requires Document/Medical product license | Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.10.31
AfterDrawingObjects Event
See Also  Example
Leadtools.Annotations Namespace > AnnContainer Class : AfterDrawingObjects Event




Occurs during drawing after the objects are drawn.

Syntax

Visual Basic (Declaration) 
Public Event AfterDrawingObjects() As EventHandler(Of AnnPaintEventArgs)
Visual Basic (Usage)Copy Code
Dim instance As AnnContainer
Dim handler As EventHandler(Of AnnPaintEventArgs)
 
AddHandler instance.AfterDrawingObjects, handler
C# 
public event EventHandler<AnnPaintEventArgs> AfterDrawingObjects()
Managed Extensions for C++ 
public: __event EventHandler<AnnPaintEventArgs>* AfterDrawingObjects();
C++/CLI 
public:
event EventHandler<AnnPaintEventArgs>^ AfterDrawingObjects();

Example

This example will draw a hatch brush on top of every object in the container.

Visual BasicCopy Code
Public Sub AnnContainer_AfterDrawingObjects(ByVal container As AnnContainer)
   ' theContainer is set so that it can be accessed in the container_BeforeDrawingObjects event
   theContainer = container
   AddHandler container.AfterDrawingObjects, AddressOf container_AfterDrawingObjects
End Sub
Private Sub container_AfterDrawingObjects(ByVal sender As Object, ByVal e As AnnPaintEventArgs)
   Dim graphics As Graphics = e.Graphics

   ' set the current transform from the container
   graphics.MultiplyTransform(theContainer.Transform)

   Dim br As Brush = New HatchBrush(HatchStyle.DiagonalCross, Color.Black, Color.Transparent)
   Try
      ' enum the objects in the container
      For Each obj As AnnObject In theContainer.Objects
         graphics.FillRectangle(br, obj.BoundingRectangle.ConvertTo(theContainer.UnitConverter, AnnUnit.Pixel).ToRectangleF())
      Next obj
   Finally
      CType(br, IDisposable).Dispose()
   End Try
End Sub
C#Copy Code
public void AnnContainer_AfterDrawingObjects(AnnContainer container) 

   // theContainer is set so that it can be accessed in the container_BeforeDrawingObjects event 
   theContainer = container; 
   container.AfterDrawingObjects += new EventHandler<AnnPaintEventArgs>(container_AfterDrawingObjects); 

private void container_AfterDrawingObjects(object sender, AnnPaintEventArgs e) 

   Graphics graphics = e.Graphics; 
 
   // set the current transform from the container 
   graphics.MultiplyTransform(theContainer.Transform); 
 
   using(Brush br = new HatchBrush(HatchStyle.DiagonalCross, Color.Black, Color.Transparent)) 
   { 
      // enum the objects in the container 
      foreach(AnnObject obj in theContainer.Objects) 
         graphics.FillRectangle(br, obj.BoundingRectangle.ConvertTo(theContainer.UnitConverter, AnnUnit.Pixel).ToRectangleF()); 
   } 
}

Remarks

You can prevent the AnnContainer from raising this event by calling DisableDrawObjectEvents. You can re-enable the raising of this event by calling EnableDrawObjectEvents.

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

Leadtools.Annotations requires a Document or Medical toolkit license and unlock key. For more information, refer to: Raster Pro/Document/Medical Features