/// <summary>
        /// This is overridden to display the editor dialog box and allows
        /// the user to edit the image map area coordinates in a more
        /// user-friendly fashion.
        /// </summary>
        /// <param name="context">The descriptor context</param>
        /// <param name="provider">The service provider</param>
        /// <param name="value">The image area coordinates</param>
        /// <returns>The edited image area coordinates</returns>
        /// <exception cref="ArgumentException">This is thrown if the area collection is not owned by an image
        /// map control.</exception>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService srv = null;

            // Get the forms editor service from the provider to display the form
            if (provider != null)
            {
                srv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));
            }

            if (srv != null)
            {
                using (ImageMapAreaEditorDlg dlg = new ImageMapAreaEditorDlg())
                {
                    IImageMap im = ImageAreaCollectionEditor.Areas.ImageMapControl;

                    if (im == null)
                    {
                        throw new ArgumentException("The area collection is not owned by an ImageMap");
                    }

                    dlg.Image       = ((EWSoftware.ImageMaps.Windows.Forms.ImageMap)im).Image;
                    dlg.ImageHeight = im.ImageMapHeight;
                    dlg.ImageWidth  = im.ImageMapWidth;
                    dlg.Coordinates = (string)value;

                    if (srv.ShowDialog(dlg) == DialogResult.OK)
                    {
                        return(dlg.Coordinates);
                    }
                }
            }

            return(value);
        }
        /// <summary>
        /// This is overridden to display the editor dialog box and allows
        /// the user to edit the image map area coordinates in a more
        /// user-friendly fashion.
        /// </summary>
        /// <param name="context">The descriptor context</param>
        /// <param name="provider">The service provider</param>
        /// <param name="value">The image area coordinates</param>
        /// <returns>The edited image area coordinates</returns>
        /// <exception cref="ArgumentException">This is thrown if the area collection is not owned by an image
        /// map control.</exception>
        public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
        {
            IWindowsFormsEditorService srv = null;

            // Get the forms editor service from the provider to display the form
            if(provider != null)
                srv = (IWindowsFormsEditorService)provider.GetService(typeof(IWindowsFormsEditorService));

            if(srv != null)
            {
                using(ImageMapAreaEditorDlg dlg = new ImageMapAreaEditorDlg())
                {
                    IImageMap im = ImageAreaCollectionEditor.Areas.ImageMapControl;

                    if(im == null)
                        throw new ArgumentException("The area collection is not owned by an ImageMap");

                    dlg.Image = ((EWSoftware.ImageMaps.Windows.Forms.ImageMap)im).Image;
                    dlg.ImageHeight = im.ImageMapHeight;
                    dlg.ImageWidth = im.ImageMapWidth;
                    dlg.Coordinates = (string)value;

                    if(srv.ShowDialog(dlg) == DialogResult.OK)
                        return dlg.Coordinates;
                }
            }

            return value;
        }