Envelop of Label Layer considering the Label rendered..

May 18, 2010 at 9:08 AM

Ciao...  is it possible to evalue the Envelop of a Label Layer including the rendered label?

 

Ciao

Alberto

May 18, 2010 at 11:42 AM

...anyway  analyzing the Label Layer...  i found a bug!

 

In the Render method:

 

            position.X = position.X - size.Width*(short) style.HorizontalAlignment*0.5f;
            position.Y = position.Y - size.Height*(short) style.VerticalAlignment*0.5f;

 

It is not correct! because  the Enumerator is defined in this way:
/// <summary> /// Label text alignment /// </summary> public enum HorizontalAlignmentEnum : short { /// <summary> /// Left oriented /// </summary> Left = 0, /// <summary> /// Right oriented /// </summary> Right = 2, /// <summary> /// Centered /// </summary> Center = 1 }

And

        /// <summary>
        /// Label text alignment
        /// </summary>
        public enum VerticalAlignmentEnum : short
        {
            /// <summary>
            /// Left oriented
            /// </summary>
            Bottom = 0,
            /// <summary>
            /// Right oriented
            /// </summary>
            Top = 2,
            /// <summary>
            /// Centered
            /// </summary>
            Middle = 1
        }

So it is necessary to modify in this way:

 

            position.X = position.X - size.Width*((short) style.HorizontalAlignment -1 )*0.5f;
            position.Y = position.Y - size.Height*((short) style.VerticalAlignment-1)*0.5f;