Occurs during drawing before the objects are drawn.
public event EventHandler<AnnPaintEventArgs> BeforeDrawingObjects Public Event BeforeDrawingObjects As EventHandler(Of AnnPaintEventArgs)
public:event EventHandler<AnnPaintEventArgs^>^ BeforeDrawingObjects
The event handler receives an argument of type AnnPaintEventArgs containing data related to this event. The following AnnPaintEventArgs properties provide information specific to this event.
| Property | Description | 
|---|---|
| Graphics | Gets the graphics used to paint. | 
You can prevent the AnnContainer from raising this event by calling DisableDrawObjectEvents. You can re-enable the raising of this event by calling EnableDrawObjectEvents.
This example will draw a grid 100 pixels apart on the surface of the viewer before the container is drawn.
using Leadtools;using Leadtools.Annotations;using Leadtools.Codecs;using Leadtools.WinForms;public AnnContainer theContainer;public void AnnContainer_BeforeDrawingObjects(AnnContainer container){// theContainer is set so that it can be accessed in the container_BeforeDrawingObjects eventtheContainer = container;container.BeforeDrawingObjects += new EventHandler<AnnPaintEventArgs>(container_BeforeDrawingObjects);}private void container_BeforeDrawingObjects(object sender, AnnPaintEventArgs e){// draw a grid, 100 pixels apartGraphics graphics = e.Graphics;// set the current transform from the containergraphics.MultiplyTransform(theContainer.Transform);// get the bounds in pixelsAnnRectangle rc = theContainer.Bounds.ConvertTo(theContainer.UnitConverter, AnnUnit.Pixel);using (Pen p = new Pen(Color.FromArgb(128, 255, 255, 255))){// draw the gridfor (float x = rc.Left; x <= rc.Right; x += 100)graphics.DrawLine(p, x, 0, x, rc.Bottom);for (float y = rc.Top; y <= rc.Bottom; y += 100)graphics.DrawLine(p, 0, y, rc.Right, y);}}
Imports LeadtoolsImports Leadtools.AnnotationsImports Leadtools.CodecsImports Leadtools.WinFormsPublic theContainer As AnnContainerPublic Sub AnnContainer_BeforeDrawingObjects(ByVal container As AnnContainer)' theContainer is set so that it can be accessed in the container_BeforeDrawingObjects eventtheContainer = containerAddHandler container.BeforeDrawingObjects, AddressOf container_BeforeDrawingObjectsEnd SubPrivate Sub container_BeforeDrawingObjects(ByVal sender As Object, ByVal e As AnnPaintEventArgs)' draw a grid, 100 pixels apartDim graphics As Graphics = e.Graphics' set the current transform from the containergraphics.MultiplyTransform(theContainer.Transform)' get the bounds in pixelsDim rc As AnnRectangle = theContainer.Bounds.ConvertTo(theContainer.UnitConverter, AnnUnit.Pixel)Dim p As Pen = New Pen(Color.FromArgb(128, 255, 255, 255))Try' draw the gridDim x As Single = rc.LeftDo While x <= rc.Rightgraphics.DrawLine(p, x, 0, x, rc.Bottom)x += 100LoopDim y As Single = rc.TopDo While y <= rc.Bottomgraphics.DrawLine(p, 0, y, rc.Right, y)y += 100LoopFinallyCType(p, IDisposable).Dispose()End TryEnd Sub
Raster .NET | C API | C++ Class Library | JavaScript HTML5
Document .NET | C API | C++ Class Library | JavaScript HTML5
Medical .NET | C API | C++ Class Library | JavaScript HTML5
Medical Web Viewer .NET
