VintaSoft Imaging .NET SDK v8.6
Vintasoft.Imaging.Annotation Namespace / AnnotationData Class / GetBoundingBox Method / GetBoundingBox(PointF,SizeF,Single) Method
Location, in device-independent pixels (1/96th inch), of annotation.
Size, in device-independent pixels (1/96th inch), of annotation
Rotation, in degrees, of annotation.
Example



In This Topic
    GetBoundingBox(PointF,SizeF,Single) Method
    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 As PointF, _
       ByVal size As SizeF, _
       ByVal rotation As Single _
    ) As RectangleF
    public abstract RectangleF GetBoundingBox( 
       PointF location,
       SizeF size,
       float rotation
    )
    public: abstract RectangleF GetBoundingBox( 
       PointF location,
       SizeF size,
       float rotation
    ) 
    public:
    abstract RectangleF GetBoundingBox( 
       PointF location,
       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
    This example shows how to restrict the rotation angle of annotation to prevent its overrunning the boundaries of a 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: Windows 10, Windows 8, Windows 7, Windows Vista, Windows XP, Windows Server 2012, Windows Server 2008, Windows Server 2003

    See Also