public Point GetRelativePoint(Control parent)
        {
            // returns parent if relativeTo doesn't point to an existing control
            // WoW will not show such controls.
            // TODO: verify exception handling

            ISerializableControl baseParent = parent as ISerializableControl;

            Control relativeControl = baseParent != null ?
                                      baseParent.DesignerLoader.BaseControls[this.relativeTo, parent] :
                                      null;

            if (relativeControl == null)
            {
                relativeControl = parent;
            }

            FRAMEPOINT relativePoint = this.relativePointSpecified ?
                                       this.relativePoint :
                                       this.point;

            Point  anchorPoint       = Point.Empty;
            string relativePointText = relativePoint.ToStringValue();

            if (relativePointText.StartsWith("BOTTOM"))
            {
                anchorPoint.Y = relativeControl.Height;
            }
            if (relativePointText.StartsWith("CENTER"))
            {
                anchorPoint.Y = relativeControl.Height / 2;
            }

            if (relativePointText.EndsWith("RIGHT"))
            {
                anchorPoint.X = relativeControl.Width;
            }
            if (relativePointText.EndsWith("CENTER"))
            {
                anchorPoint.X = relativeControl.Width / 2;
            }

            if (relativeControl != parent)
            {
                anchorPoint = relativeControl.PointToScreen(anchorPoint);
                anchorPoint = parent.PointToClient(anchorPoint);
            }
            return(anchorPoint);
        }
        public static string ToStringValue(this FRAMEPOINT framePoint)
        {
            string result = framePoint.ToString();

            switch (framePoint)
            {
            case FRAMEPOINT.LEFT:
            case FRAMEPOINT.RIGHT:
                result = "CENTER" + result;
                break;

            case FRAMEPOINT.TOP:
            case FRAMEPOINT.BOTTOM:
                result += "CENTER";
                break;
            }
            return
                (result);
        }