VintaSoft Imaging .NET SDK 14.0: Документация для .NET разработчика
Vintasoft.Imaging.Annotation Namespace / RectangleAnnotationData Class
    Класс RectangleAnnotationData
    В этом разделе
    Содержит информацию об аннотации, отображающей прямоугольник.
    Объектная модель
    AnnotationBrushBase AnnotationBrushBase AnnotationPen AnnotationComment RectangleAnnotationData
    Синтаксис
    'Declaration
    
    <SerializableAttribute()>
    Public Class RectangleAnnotationData
       Inherits AnnotationData
    
    
    [Serializable()]
    public class RectangleAnnotationData : AnnotationData
    
    
    [Serializable()]
    public __gc class RectangleAnnotationData : public AnnotationData*
    
    
    [Serializable()]
    public ref class RectangleAnnotationData : public AnnotationData^
    
    
    Ремарки

    Квадратная аннотация может быть создана из прямоугольной аннотации, если свойство Symmetry будет установлено в true.

    Пример

    Вот пример, показывающий, как создать пользовательскую прямоугольную аннотацию, которая содержит данные GPS в виде строкового значения:

    
    ''' <summary>
    ''' Contains information about the annotation that displays rectangle and holds GPS data as string.
    ''' </summary>
    ''' <remarks>
    ''' This class shows how to create annotation data with custom property.
    ''' </remarks>
    Public Class GpsRectangleAnnotationData
        Inherits Vintasoft.Imaging.Annotation.RectangleAnnotationData
    
        #Region "Constructors"
    
        ''' <summary>
        ''' Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        ''' </summary>
        Public Sub New()
            MyBase.New()
        End Sub
    
        ''' <summary>
        ''' Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        ''' </summary>
        ''' <param name="info">The SerializationInfo to populate with data.</param>
        ''' <param name="context">The destination for this serialization.</param>
        Public Sub New(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext)
            MyBase.New(info, context)
            GpsData = info.GetString("GpsData")
        End Sub
    
        #End Region
    
    
    
        #Region "Properties"
    
        Private _gpsData As String = ""
        ''' <summary>
        ''' Gets or sets information about GPS data.
        ''' </summary>
        ''' <value>
        ''' Default value is empty.
        ''' </value>
        <System.ComponentModel.Description("Information GPS data.")> _
        <System.ComponentModel.DefaultValue("")> _
        Public Property GpsData() As String
            Get
                Return _gpsData
            End Get
            Set
                If value Is Nothing Then
                    value = ""
                End If
                If _gpsData <> value Then
                    Dim changingArgs As New Vintasoft.Imaging.ObjectPropertyChangingEventArgs("GpsData", GpsData, value)
                    ' if action is not canceled
                    If OnPropertyChanging(changingArgs) Then
                        _gpsData = DirectCast(changingArgs.NewValue, String)
                        OnPropertyChanged(changingArgs.ToChangedEventArgs())
                    End If
                End If
            End Set
        End Property
    
        #End Region
    
    
    
        #Region "Methods"
    
        ''' <summary>
        ''' Populates a SerializationInfo with the data needed to serialize the target object.
        ''' </summary>
        ''' <param name="info">The SerializationInfo to populate with data.</param>
        ''' <param name="context">The destination for this serialization.</param>
        Public Overrides Sub GetObjectData(info As System.Runtime.Serialization.SerializationInfo, context As System.Runtime.Serialization.StreamingContext)
            MyBase.GetObjectData(info, context)
            info.AddValue("GpsData", GpsData)
        End Sub
    
        ''' <summary>
        ''' Copies the state of the current object to the target object.
        ''' </summary>
        ''' <param name="target">Object to copy the state of the current object to.</param>
        Public Overrides Sub CopyTo(target As Vintasoft.Imaging.Annotation.AnnotationData)
            Dim typedTarget As GpsRectangleAnnotationData = DirectCast(target, GpsRectangleAnnotationData)
    
            MyBase.CopyTo(typedTarget)
    
            typedTarget.GpsData = GpsData
        End Sub
    
        ''' <summary>
        ''' Creates a new object that is a copy of the current
        ''' <see cref="GpsRectangleAnnotationData" /> instance.
        ''' </summary>
        ''' <returns>
        ''' A new object that is a copy of this
        ''' <see cref="GpsRectangleAnnotationData" /> instance.
        ''' </returns>
        Public Overrides Function Clone() As Object
            Dim result As New GpsRectangleAnnotationData()
            Me.CopyTo(result)
            Return result
        End Function
    
        #End Region
    
    End Class
    
    
    
    /// <summary>
    /// Contains information about the annotation that displays rectangle and holds GPS data as string.
    /// </summary>
    /// <remarks>
    /// This class shows how to create annotation data with custom property.
    /// </remarks>
    public class GpsRectangleAnnotationData : Vintasoft.Imaging.Annotation.RectangleAnnotationData
    {
    
        #region Constructors
    
        /// <summary>
        /// Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        /// </summary>
        public GpsRectangleAnnotationData()
            : base()
        {
        }
    
        /// <summary>
        /// Initializes a new instance of the <see cref="GpsRectangleAnnotationData"/> class.
        /// </summary>
        /// <param name="info">The SerializationInfo to populate with data.</param>
        /// <param name="context">The destination for this serialization.</param>
        public GpsRectangleAnnotationData(System.Runtime.Serialization.SerializationInfo info, 
            System.Runtime.Serialization.StreamingContext context)
            : base(info, context)
        {
            GpsData = info.GetString("GpsData");
        }
    
        #endregion
    
    
    
        #region Properties
    
        string _gpsData = "";
        /// <summary>
        /// Gets or sets information about GPS data.
        /// </summary>
        /// <value>
        /// Default value is empty.
        /// </value>
        [System.ComponentModel.Description("Information GPS data.")]
        [System.ComponentModel.DefaultValue("")]
        public string GpsData
        {
            get
            {
                return _gpsData;
            }
            set
            {
                if (value == null)
                    value = "";
                if (_gpsData != value)
                {
                    Vintasoft.Imaging.ObjectPropertyChangingEventArgs changingArgs =
                        new Vintasoft.Imaging.ObjectPropertyChangingEventArgs("GpsData", GpsData, value);
                    // if action is not canceled
                    if (OnPropertyChanging(changingArgs))
                    {
                        _gpsData = (string)changingArgs.NewValue;
                        OnPropertyChanged(changingArgs.ToChangedEventArgs());
                    }
                }
            }
        }
    
        #endregion
    
    
    
        #region Methods
    
        /// <summary>
        /// Populates a SerializationInfo with the data needed to serialize the target object.
        /// </summary>
        /// <param name="info">The SerializationInfo to populate with data.</param>
        /// <param name="context">The destination for this serialization.</param>
        public override void GetObjectData(System.Runtime.Serialization.SerializationInfo info, 
            System.Runtime.Serialization.StreamingContext context)
        {
            base.GetObjectData(info, context);
            info.AddValue("GpsData", GpsData);
        }
    
        /// <summary>
        /// Copies the state of the current object to the target object.
        /// </summary>
        /// <param name="target">Object to copy the state of the current object to.</param>
        public override void CopyTo(Vintasoft.Imaging.Annotation.AnnotationData target)
        {
            GpsRectangleAnnotationData typedTarget = (GpsRectangleAnnotationData)target;
    
            base.CopyTo(typedTarget);
    
            typedTarget.GpsData = GpsData;
        }
    
        /// <summary>
        /// Creates a new object that is a copy of the current
        /// <see cref="GpsRectangleAnnotationData" /> instance.
        /// </summary>
        /// <returns>
        /// A new object that is a copy of this
        /// <see cref="GpsRectangleAnnotationData" /> instance.
        /// </returns>
        public override object Clone()
        {
            GpsRectangleAnnotationData result = new GpsRectangleAnnotationData();
            this.CopyTo(result);
            return result;
        }
    
        #endregion
    
    }
    
    

    Иерархия наследования
    Требования

    Целевые платформы: .NET 8; .NET 7; .NET 6; .NET Framework 4.8, 4.7, 4.6, 4.5, 4.0, 3.5

    Смотрите также