GetBoundingBox(PointF,SizeF,Single) Method (AnnotationData)
Returns the bounding box of annotation if annotation will have specified location, size and rotation.
Parameters
- location
- Location, in device-independent pixels (1/96th inch), of annotation.
- size
- Size, in device-independent pixels (1/96th inch), of annotation
- rotation
- Rotation, in degrees, of annotation.
Return Value
Bounding box of annotation.
Here is an example that shows how to restrict the rotation angle of annotation to prevent its overrunning the boundaries of specified area:
Private _boundingArea As System.Drawing.RectangleF
Private _annotation As Vintasoft.Imaging.Annotation.AnnotationData
Private Sub SubscribeOnPropertyChanging()
AddHandler _annotation.PropertyChanging, New System.EventHandler(Of Vintasoft.Imaging.ObjectPropertyChangingEventArgs)(AddressOf annotation_PropertyChanging)
End Sub
Private Sub annotation_PropertyChanging(sender As Object, e As Vintasoft.Imaging.ObjectPropertyChangingEventArgs)
If e.PropertyName = "Rotation" Then
Dim boundingBox As System.Drawing.RectangleF = _annotation.GetBoundingBox(_annotation.Location, _annotation.Size, CSng(e.NewValue))
If Not _boundingArea.Contains(boundingBox) Then
e.Cancel = True
End If
End If
End Sub
System.Drawing.RectangleF _boundingArea;
Vintasoft.Imaging.Annotation.AnnotationData _annotation;
void SubscribeOnPropertyChanging()
{
_annotation.PropertyChanging +=
new System.EventHandler<Vintasoft.Imaging.ObjectPropertyChangingEventArgs>(annotation_PropertyChanging);
}
void annotation_PropertyChanging(object sender, Vintasoft.Imaging.ObjectPropertyChangingEventArgs e)
{
if (e.PropertyName == "Rotation")
{
System.Drawing.RectangleF boundingBox = _annotation.GetBoundingBox(
_annotation.Location, _annotation.Size, (float)e.NewValue);
if (!_boundingArea.Contains(boundingBox))
{
e.Cancel = true;
}
}
}
Target Platforms: .NET 10; .NET 9; .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5