VintaSoft Imaging .NET SDK 15.1: Documentation for .NET developer
Vintasoft.Imaging.Annotation Namespace / AnnotationData Class / GetBoundingBox Methods / GetBoundingBox(PointF,SizeF,Single) Method
Syntax Example Requirements SeeAlso
In This Topic
GetBoundingBox(PointF,SizeF,Single) Method (AnnotationData)
In This Topic
Returns the bounding box of annotation if annotation will have specified location, size and rotation.
Syntax
'Declaration

Public Overloads MustOverride Function GetBoundingBox( _
ByVal location
Location, in device-independent pixels (1/96th inch), of annotation.
As System.Drawing.PointF, _
ByVal size
Size, in device-independent pixels (1/96th inch), of annotation
As System.Drawing.SizeF, _
ByVal rotation
Rotation, in degrees, of annotation.
As Single _
) As System.Drawing.RectangleF
public abstract System.Drawing.RectangleF GetBoundingBox(
System.Drawing.PointF location,
System.Drawing.SizeF size,
float 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.
Example

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;
        }
    }
}

Requirements

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

See Also